From a08dca8fe215bb6e9ddd1e553488241e78601a08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Gil=20Herrera?= Date: Thu, 28 May 2015 14:43:45 +0200 Subject: [PATCH 01/42] add Sensor for Lizard report. Parser for Lizard report (xml) created and measure persistor class created to save the measures of the lizard repor. --- .../plugins/objectivec/ObjectiveCPlugin.java | 11 +- .../complexity/LizardMeasurePersistor.java | 64 +++++++ .../complexity/LizardReportParser.java | 179 ++++++++++++++++++ .../objectivec/complexity/LizardSensor.java | 91 +++++++++ 4 files changed, 343 insertions(+), 2 deletions(-) create mode 100644 src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java create mode 100644 src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java create mode 100644 src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java index 8fa3b673..3debe84a 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java @@ -25,6 +25,7 @@ import org.sonar.api.Properties; import org.sonar.api.Property; import org.sonar.api.SonarPlugin; +import org.sonar.plugins.objectivec.complexity.LizardSensor; import org.sonar.plugins.objectivec.coverage.CoberturaSensor; import org.sonar.plugins.objectivec.colorizer.ObjectiveCColorizerFormat; import org.sonar.plugins.objectivec.core.ObjectiveC; @@ -53,11 +54,17 @@ public List> getExtensions() { ObjectiveCSquidSensor.class, ObjectiveCProfile.class, + SurefireSensor.class, + CoberturaSensor.class, + OCLintRuleRepository.class, - OCLintSensor.class, OCLintProfile.class, - OCLintProfileImporter.class + OCLintSensor.class, + OCLintProfile.class, + OCLintProfileImporter.class, + + LizardSensor.class ); } diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java new file mode 100644 index 00000000..fdfa2078 --- /dev/null +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java @@ -0,0 +1,64 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.plugins.objectivec.complexity; + +import org.slf4j.LoggerFactory; +import org.sonar.api.batch.SensorContext; +import org.sonar.api.measures.Measure; +import org.sonar.api.resources.Project; + +import java.io.File; +import java.util.List; +import java.util.Map; + +/** + * Created by agilherr on 28/05/15. + */ +@SuppressWarnings("deprecation") +public class LizardMeasurePersistor { + + private final Project project; + private final SensorContext context; + + public LizardMeasurePersistor(final Project p, final SensorContext c) { + project = p; + context = c; + } + + public void saveMeasures(final Map> measures) { + for (Map.Entry> entry : measures.entrySet()) { + final org.sonar.api.resources.File objcfile = org.sonar.api.resources.File.fromIOFile(new File(project.getFileSystem().getBasedir(), entry.getKey()), project); + if (fileExists(context, objcfile)) { + for (Measure measure : entry.getValue()) { + try { + context.saveMeasure(objcfile, measure); + } catch (Exception e) { + LoggerFactory.getLogger(getClass()).error(" Exception -> {} -> {}", entry.getKey(), measure.getMetric().getName()); + } + } + } + } + } + + private boolean fileExists(final SensorContext context, + final org.sonar.api.resources.File file) { + return context.getResource(file) != null; + } +} diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java new file mode 100644 index 00000000..20b4f9d6 --- /dev/null +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java @@ -0,0 +1,179 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.plugins.objectivec.complexity; + +import org.slf4j.LoggerFactory; +import org.sonar.api.measures.CoreMetrics; +import org.sonar.api.measures.Measure; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * Created by agilherr on 28/05/15. + */ +public class LizardReportParser { + + private static final String MEASURE = "measure"; + private static final String MEASURE_TYPE = "type"; + private static final String MEASURE_ITEM = "item"; + private static final String FILE_MEASURE = "file"; + private static final String FUNCTION_MEASURE = "Function"; + private static final String NAME = "name"; + private static final String VALUE = "value"; + private static final int CYCLOMATIC_COMPLEXITY_INDEX = 2; + private static final int FUNCTIONS_INDEX = 3; + + public Map> parseReport(final File xmlFile) { + Map> result = null; + DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); + + try { + DocumentBuilder builder = factory.newDocumentBuilder(); + Document document = builder.parse(xmlFile); + result = parseFile(document); + } catch (final IOException e) { + LoggerFactory.getLogger(getClass()).error("Error processing file named {}", xmlFile, e); + } catch (ParserConfigurationException e) { + LoggerFactory.getLogger(getClass()).error("Error processing file named {}", xmlFile, e); + } catch (SAXException e) { + LoggerFactory.getLogger(getClass()).error("Error processing file named {}", xmlFile, e); + } + + return result; + } + + public Map> parseFile(Document document) { + final Map> reportMeasures = new HashMap>(); + final List functions = new ArrayList(); + + NodeList nodeList = document.getElementsByTagName(MEASURE); + + for (int i = 0; i < nodeList.getLength(); i++) { + Node node = nodeList.item(i); + + if (node.getNodeType() == Node.ELEMENT_NODE) { + Element element = (Element) node; + if (element.getAttribute(MEASURE_TYPE).equalsIgnoreCase(FILE_MEASURE)) { + NodeList itemList = element.getElementsByTagName(MEASURE_ITEM); + addComplexityPerFileMeasure(itemList, reportMeasures); + } else if(element.getAttribute(MEASURE_TYPE).equalsIgnoreCase(FUNCTION_MEASURE)) { + NodeList itemList = element.getElementsByTagName(MEASURE_ITEM); + collectFunctions(itemList, functions); + } + } + } + + addComplexityPerFunctionMeasure(reportMeasures, functions); + + return reportMeasures; + } + + private void addComplexityPerFileMeasure(NodeList itemList, Map> reportMeasures){ + for (int i = 0; i < itemList.getLength(); i++) { + Node item = itemList.item(i); + + if (item.getNodeType() == Node.ELEMENT_NODE) { + Element itemElement = (Element) item; + String fileName = itemElement.getAttribute(NAME); + NodeList values = itemElement.getElementsByTagName(VALUE); + int fileComplexity = Integer.parseInt(values.item(CYCLOMATIC_COMPLEXITY_INDEX).getTextContent()); + int numberOfFunctions = Integer.parseInt(values.item(FUNCTIONS_INDEX).getTextContent()); + + List list = new ArrayList(); + //list.add(new Measure(CoreMetrics.COMPLEXITY).setIntValue(fileComplexity)); + list.add(new Measure(CoreMetrics.FILE_COMPLEXITY).setIntValue(fileComplexity)); + //list.add(new Measure(CoreMetrics.FUNCTIONS).setIntValue(numberOfFunctions));//TODO throws exception while saving + + reportMeasures.put(fileName, list); + } + } + } + + private void collectFunctions(NodeList itemList, List functions) { + for (int i = 0; i < itemList.getLength(); i++) { + Node item = itemList.item(i); + + if (item.getNodeType() == Node.ELEMENT_NODE) { + Element itemElement = (Element) item; + String name = itemElement.getAttribute(NAME); + String measure = itemElement.getElementsByTagName(VALUE).item(CYCLOMATIC_COMPLEXITY_INDEX).getTextContent(); + functions.add(new ObjCFunction(name, Integer.parseInt(measure))); + } + } + } + + private void addComplexityPerFunctionMeasure(Map> reportMeasures, List functions){ + for (Map.Entry> entry : reportMeasures.entrySet()) { + int count = 0; + for (ObjCFunction func : functions) { + if (func.getName().contains(entry.getKey())) { + count++; + } + } + + int complex = 0; + for (Measure m : entry.getValue()){ + if (m.getMetric().getKey().equalsIgnoreCase(CoreMetrics.FILE_COMPLEXITY.getKey())){ + complex = m.getIntValue(); + break; + } + } + + double complexMean = 0; + if (count != 0) { + complexMean = (double)complex/(double)count; + } + + entry.getValue().add(new Measure(CoreMetrics.FUNCTION_COMPLEXITY, complexMean)); + } + } + + private class ObjCFunction { + private String name; + private int cyclomaticComplexity; + + public ObjCFunction(String name, int cyclomaticComplexity) { + this.name = name; + this.cyclomaticComplexity = cyclomaticComplexity; + } + + public String getName() { + return name; + } + + public int getCyclomaticComplexity() { + return cyclomaticComplexity; + } + + } +} diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java new file mode 100644 index 00000000..89aaaff3 --- /dev/null +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java @@ -0,0 +1,91 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ + +package org.sonar.plugins.objectivec.complexity; + +import org.slf4j.LoggerFactory; +import org.sonar.api.batch.Sensor; +import org.sonar.api.batch.SensorContext; +import org.sonar.api.batch.fs.FileSystem; +import org.sonar.api.config.Settings; +import org.sonar.api.measures.Measure; +import org.sonar.api.resources.Project; +import org.sonar.plugins.objectivec.ObjectiveCPlugin; +import org.sonar.plugins.objectivec.core.ObjectiveC; + +import java.io.File; +import java.util.List; +import java.util.Map; + +/** + * Created by agilherr on 28/05/15. + */ +@SuppressWarnings("deprecation") +public class LizardSensor implements Sensor { + + public static final String REPORT_PATH_KEY = ObjectiveCPlugin.PROPERTY_PREFIX + + ".lizard.report"; + public static final String DEFAULT_REPORT_PATH = "sonar-reports/lizard-report.xml"; + + private final Settings conf; + private final FileSystem fileSystem; + + public LizardSensor(final FileSystem moduleFileSystem, final Settings config) { + this.conf = config; + this.fileSystem = moduleFileSystem; + } + + @Override + public boolean shouldExecuteOnProject(Project project) { + return project.isRoot() && fileSystem.languages().contains(ObjectiveC.KEY); + } + + @Override + public void analyse(Project project, SensorContext sensorContext) { + final String projectBaseDir = project.getFileSystem().getBasedir().getPath(); + Map> measures = parseReportsIn(projectBaseDir, new LizardReportParser()); + + for (Map.Entry> entry: measures.entrySet()) { + String[] filePath = entry.getKey().split("/"); + LoggerFactory.getLogger(getClass()).info("{}", filePath[filePath.length - 1]); + for (Measure measure : entry.getValue()) { + LoggerFactory.getLogger(getClass()).info(" {} = {}", measure.getMetric().getName(), measure.getValue()); + } + } + + new LizardMeasurePersistor(project, sensorContext).saveMeasures(measures); + } + + //key = file name, + private Map> parseReportsIn(final String baseDir, LizardReportParser parser) { + final StringBuilder reportFileName = new StringBuilder(baseDir); + reportFileName.append("/").append(reportPath()); + LoggerFactory.getLogger(getClass()).info("Processing complexity report "); + return parser.parseReport(new File(reportFileName.toString())); + } + + private String reportPath() { + String reportPath = conf.getString(REPORT_PATH_KEY); + if (reportPath == null) { + reportPath = DEFAULT_REPORT_PATH; + } + return reportPath; + } +} From 8065fe5f313cda91079f853a7517a1c9e8528da1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Gil=20Herrera?= Date: Thu, 28 May 2015 16:45:21 +0200 Subject: [PATCH 02/42] lizard sensor saves file complexity and function complexity but those values are displayed as 0 in the dashboard. Trying to savin complexity throws exception -> Can not add the same measure twice on org.sonar.api.resources.File ... --- .../complexity/LizardMeasurePersistor.java | 33 ++++++++++++++++--- .../complexity/LizardReportParser.java | 15 ++++++--- .../objectivec/complexity/LizardSensor.java | 2 +- 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java index fdfa2078..86952f6a 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java @@ -21,10 +21,11 @@ import org.slf4j.LoggerFactory; import org.sonar.api.batch.SensorContext; +import org.sonar.api.batch.fs.FileSystem; +import org.sonar.api.batch.fs.InputFile; import org.sonar.api.measures.Measure; import org.sonar.api.resources.Project; -import java.io.File; import java.util.List; import java.util.Map; @@ -36,13 +37,36 @@ public class LizardMeasurePersistor { private final Project project; private final SensorContext context; + private final FileSystem fileSystem; - public LizardMeasurePersistor(final Project p, final SensorContext c) { - project = p; - context = c; + public LizardMeasurePersistor(final Project p, final SensorContext c, final FileSystem fileSystem) { + this.project = p; + this.context = c; + this.fileSystem = fileSystem; } public void saveMeasures(final Map> measures) { + + for (InputFile file : fileSystem.inputFiles(fileSystem.predicates().all())) { + //LoggerFactory.getLogger(getClass()).info("Inputfile {} \n {}", file.absolutePath(), file.relativePath()); + for (Map.Entry> entry : measures.entrySet()){ + String path = entry.getKey(); + String name = file.relativePath(); + if (path.equalsIgnoreCase(name)){ + //LoggerFactory.getLogger(getClass()).info("Save Measures for inputfile"); + for (Measure measure : entry.getValue()){ + try { + context.saveMeasure(file, measure); + } catch (Exception e) { + LoggerFactory.getLogger(getClass()).error(" Exception -> {} -> {} \n {}", entry.getKey(), measure.getMetric().getName(), e.getMessage()); + } + } + break; + } + } + } + + /* for (Map.Entry> entry : measures.entrySet()) { final org.sonar.api.resources.File objcfile = org.sonar.api.resources.File.fromIOFile(new File(project.getFileSystem().getBasedir(), entry.getKey()), project); if (fileExists(context, objcfile)) { @@ -55,6 +79,7 @@ public void saveMeasures(final Map> measures) { } } } + */ } private boolean fileExists(final SensorContext context, diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java index 20b4f9d6..09d95c47 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java @@ -22,6 +22,7 @@ import org.slf4j.LoggerFactory; import org.sonar.api.measures.CoreMetrics; import org.sonar.api.measures.Measure; +import org.sonar.api.measures.Metric; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -106,13 +107,16 @@ private void addComplexityPerFileMeasure(NodeList itemList, Map list = new ArrayList(); - //list.add(new Measure(CoreMetrics.COMPLEXITY).setIntValue(fileComplexity)); - list.add(new Measure(CoreMetrics.FILE_COMPLEXITY).setIntValue(fileComplexity)); - //list.add(new Measure(CoreMetrics.FUNCTIONS).setIntValue(numberOfFunctions));//TODO throws exception while saving + Metric complexityMetric = CoreMetrics.COMPLEXITY; + complexityMetric.setDomain("complexity"); + list.add(new Measure(CoreMetrics.COMPLEXITY).setIntValue(complexity)); + list.add(new Measure(CoreMetrics.FUNCTIONS).setIntValue(numberOfFunctions));//TODO throws exception while saving + list.add(new Measure(CoreMetrics.FILE_COMPLEXITY, fileComplexity)); reportMeasures.put(fileName, list); } @@ -135,9 +139,11 @@ private void collectFunctions(NodeList itemList, List functions) { private void addComplexityPerFunctionMeasure(Map> reportMeasures, List functions){ for (Map.Entry> entry : reportMeasures.entrySet()) { int count = 0; + int complexityInFunctions = 0; for (ObjCFunction func : functions) { if (func.getName().contains(entry.getKey())) { count++; + complexityInFunctions += func.getCyclomaticComplexity(); } } @@ -154,6 +160,7 @@ private void addComplexityPerFunctionMeasure(Map> reportMe complexMean = (double)complex/(double)count; } + entry.getValue().add(new Measure(CoreMetrics.COMPLEXITY_IN_FUNCTIONS).setIntValue(complexityInFunctions)); entry.getValue().add(new Measure(CoreMetrics.FUNCTION_COMPLEXITY, complexMean)); } } diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java index 89aaaff3..4025c6c4 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java @@ -70,7 +70,7 @@ public void analyse(Project project, SensorContext sensorContext) { } } - new LizardMeasurePersistor(project, sensorContext).saveMeasures(measures); + new LizardMeasurePersistor(project, sensorContext, fileSystem).saveMeasures(measures); } //key = file name, From e9148834749a8de76ea003615ac25a423959ec5a Mon Sep 17 00:00:00 2001 From: Andres Gil Herrera Date: Thu, 28 May 2015 20:01:14 +0200 Subject: [PATCH 03/42] properties for lizard and lizard report is now generated by run-sonar.sh --- sample/sonar-project.properties | 4 ++++ src/main/shell/run-sonar.sh | 12 ++++++++++++ 2 files changed, 16 insertions(+) diff --git a/sample/sonar-project.properties b/sample/sonar-project.properties index 41ed559f..58797447 100644 --- a/sample/sonar-project.properties +++ b/sample/sonar-project.properties @@ -48,6 +48,10 @@ sonar.sourceEncoding=UTF-8 # Change it only if you generate the file on your own # sonar.objectivec.oclint.report=sonar-reports/oclint.xml +# Lizard report generated by run-sonar.sh is stored in sonar-reports/lizard-report.xml +# Change it only if you generate the file on your own +# sonar.objectivec.lizard.report=sonar-reports/lizard-report.xml + # Paths to exclude from coverage report (tests, 3rd party libraries etc.) # sonar.objectivec.excludedPathsFromCoverage=pattern1,pattern2 sonar.objectivec.excludedPathsFromCoverage=.*Tests.* diff --git a/src/main/shell/run-sonar.sh b/src/main/shell/run-sonar.sh index f82d33ef..8267fb93 100755 --- a/src/main/shell/run-sonar.sh +++ b/src/main/shell/run-sonar.sh @@ -117,6 +117,7 @@ function runCommand() { vflag="" nflag="" oclint="on" +lizard="on" while [ $# -gt 0 ] do case "$1" in @@ -293,6 +294,17 @@ else echo 'Skipping OCLint (test purposes only!)' fi +if [ "$lizard" = "on" ]; then + + # Lizard + echo -n 'Running Lizard...' + + # Run Lizard with xml output option and write the output in sonar-reports/lizard-report.xml + runCommand lizard --xml "$srcDirs" > sonar-reports/lizard-report.xml +else + echo 'Skipping Lizard (test purposes only!)' +fi + # SonarQube echo -n 'Running SonarQube using SonarQube Runner' runCommand /dev/stdout sonar-runner From 5b52843c0a3341e34f57545e6083424a9e4e20e9 Mon Sep 17 00:00:00 2001 From: Andres Gil Herrera Date: Fri, 29 May 2015 00:04:08 +0200 Subject: [PATCH 04/42] ObjectiveCSquidSensor does not save functions and complexity as it would actually do because it was causing that saving comlexity and functions for files throw exception. Lizard measure now saves the measures succesfully --- .../objectivec/ObjectiveCSquidSensor.java | 4 +-- .../complexity/LizardMeasurePersistor.java | 29 ++++++++++++------- .../complexity/LizardReportParser.java | 3 +- .../objectivec/complexity/LizardSensor.java | 4 ++- src/main/shell/run-sonar.sh | 2 +- 5 files changed, 26 insertions(+), 16 deletions(-) diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java index 43bbb5e9..9c9b3f0e 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java @@ -102,9 +102,9 @@ private void saveMeasures(File sonarFile, SourceFile squidFile) { context.saveMeasure(sonarFile, CoreMetrics.FILES, squidFile.getDouble(ObjectiveCMetric.FILES)); context.saveMeasure(sonarFile, CoreMetrics.LINES, squidFile.getDouble(ObjectiveCMetric.LINES)); context.saveMeasure(sonarFile, CoreMetrics.NCLOC, squidFile.getDouble(ObjectiveCMetric.LINES_OF_CODE)); - context.saveMeasure(sonarFile, CoreMetrics.FUNCTIONS, squidFile.getDouble(ObjectiveCMetric.FUNCTIONS)); + //context.saveMeasure(sonarFile, CoreMetrics.FUNCTIONS, squidFile.getDouble(ObjectiveCMetric.FUNCTIONS)); context.saveMeasure(sonarFile, CoreMetrics.STATEMENTS, squidFile.getDouble(ObjectiveCMetric.STATEMENTS)); - context.saveMeasure(sonarFile, CoreMetrics.COMPLEXITY, squidFile.getDouble(ObjectiveCMetric.COMPLEXITY)); + //context.saveMeasure(sonarFile, CoreMetrics.COMPLEXITY, squidFile.getDouble(ObjectiveCMetric.COMPLEXITY)); context.saveMeasure(sonarFile, CoreMetrics.COMMENT_LINES, squidFile.getDouble(ObjectiveCMetric.COMMENT_LINES)); } diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java index 86952f6a..919f21a6 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java @@ -20,12 +20,14 @@ package org.sonar.plugins.objectivec.complexity; import org.slf4j.LoggerFactory; +import org.sonar.api.batch.DecoratorContext; import org.sonar.api.batch.SensorContext; import org.sonar.api.batch.fs.FileSystem; import org.sonar.api.batch.fs.InputFile; import org.sonar.api.measures.Measure; import org.sonar.api.resources.Project; +import java.io.File; import java.util.List; import java.util.Map; @@ -35,18 +37,25 @@ @SuppressWarnings("deprecation") public class LizardMeasurePersistor { - private final Project project; - private final SensorContext context; - private final FileSystem fileSystem; + private Project project; + private SensorContext sensorContext; + private DecoratorContext decoratorContext; + private FileSystem fileSystem; + + public LizardMeasurePersistor(final Project p, final DecoratorContext c) { + this.project = p; + this.decoratorContext = c; + this.fileSystem = fileSystem; + } public LizardMeasurePersistor(final Project p, final SensorContext c, final FileSystem fileSystem) { this.project = p; - this.context = c; + this.sensorContext = c; this.fileSystem = fileSystem; } public void saveMeasures(final Map> measures) { - +/* for (InputFile file : fileSystem.inputFiles(fileSystem.predicates().all())) { //LoggerFactory.getLogger(getClass()).info("Inputfile {} \n {}", file.absolutePath(), file.relativePath()); for (Map.Entry> entry : measures.entrySet()){ @@ -56,7 +65,7 @@ public void saveMeasures(final Map> measures) { //LoggerFactory.getLogger(getClass()).info("Save Measures for inputfile"); for (Measure measure : entry.getValue()){ try { - context.saveMeasure(file, measure); + sensorContext.saveMeasure(file, measure); } catch (Exception e) { LoggerFactory.getLogger(getClass()).error(" Exception -> {} -> {} \n {}", entry.getKey(), measure.getMetric().getName(), e.getMessage()); } @@ -66,20 +75,20 @@ public void saveMeasures(final Map> measures) { } } - /* + */ for (Map.Entry> entry : measures.entrySet()) { final org.sonar.api.resources.File objcfile = org.sonar.api.resources.File.fromIOFile(new File(project.getFileSystem().getBasedir(), entry.getKey()), project); - if (fileExists(context, objcfile)) { + if (fileExists(sensorContext, objcfile)) { for (Measure measure : entry.getValue()) { try { - context.saveMeasure(objcfile, measure); + sensorContext.saveMeasure(objcfile, measure); } catch (Exception e) { LoggerFactory.getLogger(getClass()).error(" Exception -> {} -> {}", entry.getKey(), measure.getMetric().getName()); } } } } - */ + } private boolean fileExists(final SensorContext context, diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java index 09d95c47..9a313062 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java @@ -115,7 +115,7 @@ private void addComplexityPerFileMeasure(NodeList itemList, Map functions) { for (int i = 0; i < itemList.getLength(); i++) { Node item = itemList.item(i); - if (item.getNodeType() == Node.ELEMENT_NODE) { Element itemElement = (Element) item; String name = itemElement.getAttribute(NAME); diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java index 4025c6c4..b66afb90 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java @@ -62,6 +62,7 @@ public void analyse(Project project, SensorContext sensorContext) { final String projectBaseDir = project.getFileSystem().getBasedir().getPath(); Map> measures = parseReportsIn(projectBaseDir, new LizardReportParser()); + /* for (Map.Entry> entry: measures.entrySet()) { String[] filePath = entry.getKey().split("/"); LoggerFactory.getLogger(getClass()).info("{}", filePath[filePath.length - 1]); @@ -69,8 +70,9 @@ public void analyse(Project project, SensorContext sensorContext) { LoggerFactory.getLogger(getClass()).info(" {} = {}", measure.getMetric().getName(), measure.getValue()); } } + */ - new LizardMeasurePersistor(project, sensorContext, fileSystem).saveMeasures(measures); + new LizardMeasurePersistor(project, sensorContext, fileSystem).saveMeasuresForSensor(measures); } //key = file name, diff --git a/src/main/shell/run-sonar.sh b/src/main/shell/run-sonar.sh index 8267fb93..e4e9f68b 100755 --- a/src/main/shell/run-sonar.sh +++ b/src/main/shell/run-sonar.sh @@ -300,7 +300,7 @@ if [ "$lizard" = "on" ]; then echo -n 'Running Lizard...' # Run Lizard with xml output option and write the output in sonar-reports/lizard-report.xml - runCommand lizard --xml "$srcDirs" > sonar-reports/lizard-report.xml + lizard --xml "$srcDirs" > sonar-reports/lizard-report.xml else echo 'Skipping Lizard (test purposes only!)' fi From d42fe0163475b5b6c2036812f6373cd24f79bc8d Mon Sep 17 00:00:00 2001 From: Andres Gil Herrera Date: Fri, 29 May 2015 00:05:59 +0200 Subject: [PATCH 05/42] resolve little refactoring error --- .../org/sonar/plugins/objectivec/complexity/LizardSensor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java index b66afb90..7a9a4686 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java @@ -72,7 +72,7 @@ public void analyse(Project project, SensorContext sensorContext) { } */ - new LizardMeasurePersistor(project, sensorContext, fileSystem).saveMeasuresForSensor(measures); + new LizardMeasurePersistor(project, sensorContext, fileSystem).saveMeasures(measures); } //key = file name, From 5013d75b982e2c755fd4397cba150abe8f3aa715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Gil=20Herrera?= Date: Wed, 3 Jun 2015 16:48:22 +0200 Subject: [PATCH 06/42] tests --- .../objectivec/ObjectiveCSquidSensor.java | 5 + .../complexity/LizardMeasurePersistor.java | 36 +--- .../complexity/LizardReportParser.java | 5 +- .../objectivec/complexity/LizardSensor.java | 18 +- .../complexity/LizardReportParserTest.java | 160 ++++++++++++++++++ .../complexity/LizardSensorTest.java | 79 +++++++++ 6 files changed, 253 insertions(+), 50 deletions(-) create mode 100644 src/test/java/org/sonar/plugins/objectivec/complexity/LizardReportParserTest.java create mode 100644 src/test/java/org/sonar/plugins/objectivec/complexity/LizardSensorTest.java diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java index 9c9b3f0e..8b59781e 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java @@ -102,6 +102,11 @@ private void saveMeasures(File sonarFile, SourceFile squidFile) { context.saveMeasure(sonarFile, CoreMetrics.FILES, squidFile.getDouble(ObjectiveCMetric.FILES)); context.saveMeasure(sonarFile, CoreMetrics.LINES, squidFile.getDouble(ObjectiveCMetric.LINES)); context.saveMeasure(sonarFile, CoreMetrics.NCLOC, squidFile.getDouble(ObjectiveCMetric.LINES_OF_CODE)); + /** + * Saving the same measure more than one for a file throws an exception and that is why + * CoreMetrics.FUNCTIONS and CoreMetrics.COMPLEXITY are not allowed to be saved here, In order for the + * LizardSensor to be able to to its job and save the values for those metrics. + */ //context.saveMeasure(sonarFile, CoreMetrics.FUNCTIONS, squidFile.getDouble(ObjectiveCMetric.FUNCTIONS)); context.saveMeasure(sonarFile, CoreMetrics.STATEMENTS, squidFile.getDouble(ObjectiveCMetric.STATEMENTS)); //context.saveMeasure(sonarFile, CoreMetrics.COMPLEXITY, squidFile.getDouble(ObjectiveCMetric.COMPLEXITY)); diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java index 919f21a6..af19c023 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java @@ -32,50 +32,20 @@ import java.util.Map; /** - * Created by agilherr on 28/05/15. + * @author Andres Gil Herrera + * @since 28/05/15. */ -@SuppressWarnings("deprecation") public class LizardMeasurePersistor { private Project project; private SensorContext sensorContext; - private DecoratorContext decoratorContext; - private FileSystem fileSystem; - public LizardMeasurePersistor(final Project p, final DecoratorContext c) { - this.project = p; - this.decoratorContext = c; - this.fileSystem = fileSystem; - } - - public LizardMeasurePersistor(final Project p, final SensorContext c, final FileSystem fileSystem) { + public LizardMeasurePersistor(final Project p, final SensorContext c) { this.project = p; this.sensorContext = c; - this.fileSystem = fileSystem; } public void saveMeasures(final Map> measures) { -/* - for (InputFile file : fileSystem.inputFiles(fileSystem.predicates().all())) { - //LoggerFactory.getLogger(getClass()).info("Inputfile {} \n {}", file.absolutePath(), file.relativePath()); - for (Map.Entry> entry : measures.entrySet()){ - String path = entry.getKey(); - String name = file.relativePath(); - if (path.equalsIgnoreCase(name)){ - //LoggerFactory.getLogger(getClass()).info("Save Measures for inputfile"); - for (Measure measure : entry.getValue()){ - try { - sensorContext.saveMeasure(file, measure); - } catch (Exception e) { - LoggerFactory.getLogger(getClass()).error(" Exception -> {} -> {} \n {}", entry.getKey(), measure.getMetric().getName(), e.getMessage()); - } - } - break; - } - } - } - - */ for (Map.Entry> entry : measures.entrySet()) { final org.sonar.api.resources.File objcfile = org.sonar.api.resources.File.fromIOFile(new File(project.getFileSystem().getBasedir(), entry.getKey()), project); if (fileExists(sensorContext, objcfile)) { diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java index 9a313062..e7c68d54 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java @@ -40,7 +40,8 @@ import java.util.Map; /** - * Created by agilherr on 28/05/15. + * @author Andres Gil Herrera + * @since 28/05/15 */ public class LizardReportParser { @@ -112,8 +113,6 @@ private void addComplexityPerFileMeasure(NodeList itemList, Map list = new ArrayList(); - Metric complexityMetric = CoreMetrics.COMPLEXITY; - complexityMetric.setDomain("complexity"); list.add(new Measure(CoreMetrics.COMPLEXITY).setIntValue(complexity)); list.add(new Measure(CoreMetrics.FUNCTIONS).setIntValue(numberOfFunctions)); list.add(new Measure(CoreMetrics.FILE_COMPLEXITY, fileComplexity)); diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java index 7a9a4686..30f3e512 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java @@ -35,7 +35,8 @@ import java.util.Map; /** - * Created by agilherr on 28/05/15. + * @author Andres Gil Herrera + * @since 28/05/15 */ @SuppressWarnings("deprecation") public class LizardSensor implements Sensor { @@ -61,21 +62,10 @@ public boolean shouldExecuteOnProject(Project project) { public void analyse(Project project, SensorContext sensorContext) { final String projectBaseDir = project.getFileSystem().getBasedir().getPath(); Map> measures = parseReportsIn(projectBaseDir, new LizardReportParser()); - - /* - for (Map.Entry> entry: measures.entrySet()) { - String[] filePath = entry.getKey().split("/"); - LoggerFactory.getLogger(getClass()).info("{}", filePath[filePath.length - 1]); - for (Measure measure : entry.getValue()) { - LoggerFactory.getLogger(getClass()).info(" {} = {}", measure.getMetric().getName(), measure.getValue()); - } - } - */ - - new LizardMeasurePersistor(project, sensorContext, fileSystem).saveMeasures(measures); + new LizardMeasurePersistor(project, sensorContext).saveMeasures(measures); } - //key = file name, + //key = file name private Map> parseReportsIn(final String baseDir, LizardReportParser parser) { final StringBuilder reportFileName = new StringBuilder(baseDir); reportFileName.append("/").append(reportPath()); diff --git a/src/test/java/org/sonar/plugins/objectivec/complexity/LizardReportParserTest.java b/src/test/java/org/sonar/plugins/objectivec/complexity/LizardReportParserTest.java new file mode 100644 index 00000000..de60e7cb --- /dev/null +++ b/src/test/java/org/sonar/plugins/objectivec/complexity/LizardReportParserTest.java @@ -0,0 +1,160 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ + +package org.sonar.plugins.objectivec.complexity; + +import org.apache.log4j.spi.LoggerFactory; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; +import org.sonar.api.measures.CoreMetrics; +import org.sonar.api.measures.Measure; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.util.List; +import java.util.Map; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertTrue; + +/** + * @author Andres Gil Herrera + * @since 03/06/15. + */ +public class LizardReportParserTest { + + @Rule + public TemporaryFolder folder = new TemporaryFolder(); + + private File correctFile; + private File incorrectFile; + + @Before + public void setup() throws IOException { + correctFile = createCorrectFile(); + incorrectFile = folder.newFile("incorrectFile.xml"); + } + + public File createCorrectFile() throws IOException { + File xmlFile = folder.newFile("correctFile.xml"); + BufferedWriter out = new BufferedWriter(new FileWriter(xmlFile)); + //header + out.write(""); + out.write(""); + //root object and measure + out.write(""); + //items for function + out.write(""); + out.write("2151"); + out.write(""); + out.write("3205"); + //average and close funciton measure + out.write(""); + out.write(""); + out.write(""); + //open file measure and add the labels + out.write(""); + //items for file + out.write(""); + out.write("1200"); + out.write(""); + out.write("286862"); + //add averages + out.write(""); + //add sum + out.write(""); + //close measures and root object + out.write(""); + + out.close(); + + return xmlFile; + } + + @Test + public void parseReportShouldReturnMapWhenXMLFileIsCorrect() { + LizardReportParser parser = new LizardReportParser(); + + assertNotNull("correct file is null", correctFile); + + Map> report = parser.parseReport(correctFile); + + assertNotNull("report is null", report); + + assertTrue("Key is not there", report.containsKey("VW_R_App/Controller/Accelerate/VWRAccelerationViewController.h")); + List list1 = report.get("VW_R_App/Controller/Accelerate/VWRAccelerationViewController.h"); + assertEquals(0, list1.size()); + + /*for (Measure measure : list1) { + + String s = measure.getMetric().getKey(); + + if (s.equals(CoreMetrics.FUNCTIONS_KEY)) { + assertEquals("Header Functions has a wrong value", Integer.valueOf(0), measure.getIntValue()); + } else if (s.equals(CoreMetrics.COMPLEXITY_KEY)) { + assertEquals("Header Complexity has a wrong value", Integer.valueOf(0), measure.getIntValue()); + } else if (s.equals(CoreMetrics.FILE_COMPLEXITY_KEY)) { + assertEquals("Header File Complexity has a wrong value", Double.valueOf(0.0d), measure.getValue()); + } else if (s.equals(CoreMetrics.COMPLEXITY_IN_FUNCTIONS_KEY)) { + assertEquals("Header Complexity in Functions has a wrong value", Integer.valueOf(0), measure.getIntValue()); + } else if (s.equals(CoreMetrics.FUNCTION_COMPLEXITY)) { + assertEquals("Header Functions Complexity has a wrong value", Double.valueOf(0.0d), measure.getValue()); + } + + }*/ + + assertTrue("Key is not there", report.containsKey("VW_R_App/Controller/Accelerate/VWRAccelerationViewController.m")); + + + List list2 = report.get("VW_R_App/Controller/Accelerate/VWRAccelerationViewController.h"); + + /*for (Measure measure : list2) { + + org.slf4j.LoggerFactory.getLogger(getClass()).info("{}", measure); + + String s = measure.getMetric().getKey(); + + if (s.equals(CoreMetrics.FUNCTIONS_KEY)) { + assertEquals("MFile Functions has a wrong value", Integer.valueOf(2), measure.getIntValue()); + } else if (s.equals(CoreMetrics.COMPLEXITY_KEY)) { + assertEquals("MFile Complexity has a wrong value", Integer.valueOf(6), measure.getIntValue()); + } else if (s.equals(CoreMetrics.FILE_COMPLEXITY_KEY)) { + assertEquals("MFile File Complexity has a wrong value", Double.valueOf(6.0d), measure.getValue()); + } else if (s.equals(CoreMetrics.COMPLEXITY_IN_FUNCTIONS_KEY)) { + assertEquals("MFile Complexity in Functions has a wrong value", Integer.valueOf(6), measure.getIntValue()); + } else if (s.equals(CoreMetrics.FUNCTION_COMPLEXITY)) { + assertEquals("MFile Functions Complexity has a wrong value", 3.0d, measure.getValue(), 0.0d); + } + + }*/ + + } + + @Test + public void parseReportShouldReturnEmptyMapWhenXMLFileIsIncorrect() { + + } + +} diff --git a/src/test/java/org/sonar/plugins/objectivec/complexity/LizardSensorTest.java b/src/test/java/org/sonar/plugins/objectivec/complexity/LizardSensorTest.java new file mode 100644 index 00000000..15774fa9 --- /dev/null +++ b/src/test/java/org/sonar/plugins/objectivec/complexity/LizardSensorTest.java @@ -0,0 +1,79 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ + +package org.sonar.plugins.objectivec.complexity; + +import org.junit.Before; +import org.junit.Test; +import org.sonar.api.batch.fs.FileSystem; +import org.sonar.api.config.Settings; +import org.sonar.api.resources.Project; +import org.sonar.plugins.objectivec.core.ObjectiveC; + +import java.util.SortedSet; +import java.util.TreeSet; + +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; + +/** + * @author Andres Gil Herrera + * @since 03/06/15. + */ +public class LizardSensorTest { + + private Settings settings; + + @Before + public void setUp() { + settings = new Settings(); + } + + @Test + public void shouldExecuteOnProjectShouldBeTrueWhenProjectIsObjc() { + final Project project = new Project("Test"); + + FileSystem fileSystem = mock(FileSystem.class); + SortedSet languages = new TreeSet(); + languages.add(ObjectiveC.KEY); + when(fileSystem.languages()).thenReturn(languages); + + final LizardSensor testedSensor = new LizardSensor(fileSystem, settings); + + assertTrue(testedSensor.shouldExecuteOnProject(project)); + } + + @Test + public void shouldExecuteOnProjectShouldBeFalseWhenProjectIsSomethingElse() { + final Project project = new Project("Test"); + + FileSystem fileSystem = mock(FileSystem.class); + SortedSet languages = new TreeSet(); + languages.add("Test"); + when(fileSystem.languages()).thenReturn(languages); + + final LizardSensor testedSensor = new LizardSensor(fileSystem, settings); + + assertFalse(testedSensor.shouldExecuteOnProject(project)); + } + +} From 7091d1650c985dcd803dd2f88cb81da5ab7cbeae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Gil=20Herrera?= Date: Thu, 4 Jun 2015 15:26:18 +0200 Subject: [PATCH 07/42] tests finished --- .../complexity/LizardReportParser.java | 23 +++-- src/main/shell/run-sonar.sh | 3 +- .../complexity/LizardReportParserTest.java | 97 ++++++++++++------- 3 files changed, 77 insertions(+), 46 deletions(-) diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java index e7c68d54..37e4a39a 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java @@ -145,21 +145,20 @@ private void addComplexityPerFunctionMeasure(Map> reportMe } } - int complex = 0; - for (Measure m : entry.getValue()){ - if (m.getMetric().getKey().equalsIgnoreCase(CoreMetrics.FILE_COMPLEXITY.getKey())){ - complex = m.getIntValue(); - break; + if (count != 0) { + entry.getValue().add(new Measure(CoreMetrics.COMPLEXITY_IN_FUNCTIONS).setIntValue(complexityInFunctions)); + + double complex = 0; + for (Measure m : entry.getValue()){ + if (m.getMetric().getKey().equalsIgnoreCase(CoreMetrics.FILE_COMPLEXITY.getKey())){ + complex = m.getValue(); + break; + } } - } - double complexMean = 0; - if (count != 0) { - complexMean = (double)complex/(double)count; + double complexMean = complex/(double)count; + entry.getValue().add(new Measure(CoreMetrics.FUNCTION_COMPLEXITY, complexMean)); } - - entry.getValue().add(new Measure(CoreMetrics.COMPLEXITY_IN_FUNCTIONS).setIntValue(complexityInFunctions)); - entry.getValue().add(new Measure(CoreMetrics.FUNCTION_COMPLEXITY, complexMean)); } } diff --git a/src/main/shell/run-sonar.sh b/src/main/shell/run-sonar.sh index e4e9f68b..6024e5b0 100755 --- a/src/main/shell/run-sonar.sh +++ b/src/main/shell/run-sonar.sh @@ -165,7 +165,8 @@ srcDirs=''; readParameter srcDirs 'sonar.sources' appScheme=''; readParameter appScheme 'sonar.objectivec.appScheme' # The name of your test scheme in Xcode -testScheme=''; readParameter testScheme 'sonar.objectivec.testScheme' +testScheme=''; readParameter testScheme ' +c.testScheme' # The file patterns to exclude from coverage report excludedPathsFromCoverage=''; readParameter excludedPathsFromCoverage 'sonar.objectivec.excludedPathsFromCoverage' diff --git a/src/test/java/org/sonar/plugins/objectivec/complexity/LizardReportParserTest.java b/src/test/java/org/sonar/plugins/objectivec/complexity/LizardReportParserTest.java index de60e7cb..7365340b 100644 --- a/src/test/java/org/sonar/plugins/objectivec/complexity/LizardReportParserTest.java +++ b/src/test/java/org/sonar/plugins/objectivec/complexity/LizardReportParserTest.java @@ -20,7 +20,6 @@ package org.sonar.plugins.objectivec.complexity; -import org.apache.log4j.spi.LoggerFactory; import org.junit.Before; import org.junit.Rule; import org.junit.Test; @@ -35,9 +34,7 @@ import java.util.List; import java.util.Map; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.*; /** * @author Andres Gil Herrera @@ -54,7 +51,7 @@ public class LizardReportParserTest { @Before public void setup() throws IOException { correctFile = createCorrectFile(); - incorrectFile = folder.newFile("incorrectFile.xml"); + incorrectFile = createIncorrectFile(); } public File createCorrectFile() throws IOException { @@ -93,6 +90,42 @@ public File createCorrectFile() throws IOException { return xmlFile; } + public File createIncorrectFile() throws IOException { + File xmlFile = folder.newFile("incorrectFile.xml"); + BufferedWriter out = new BufferedWriter(new FileWriter(xmlFile)); + //header + out.write(""); + out.write(""); + //root object and measure + out.write(""); + //items for function + out.write(""); + out.write("2151"); + out.write(""); + out.write("3205"); + //average and close funciton measure + out.write(""); + out.write(""); + out.write(""); + //open file measure and add the labels + out.write(""); + //items for file 3th value tag has no closing tag + out.write(""); + out.write("1200"); + out.write(""); + out.write("286862"); + //add averages + out.write(""); + //add sum + out.write(""); + //close measures and root object no close tag for measure + out.write(""); + + out.close(); + + return xmlFile; + } + @Test public void parseReportShouldReturnMapWhenXMLFileIsCorrect() { LizardReportParser parser = new LizardReportParser(); @@ -105,55 +138,53 @@ public void parseReportShouldReturnMapWhenXMLFileIsCorrect() { assertTrue("Key is not there", report.containsKey("VW_R_App/Controller/Accelerate/VWRAccelerationViewController.h")); List list1 = report.get("VW_R_App/Controller/Accelerate/VWRAccelerationViewController.h"); - assertEquals(0, list1.size()); - - /*for (Measure measure : list1) { + assertEquals(3, list1.size()); + for (Measure measure : list1) { String s = measure.getMetric().getKey(); if (s.equals(CoreMetrics.FUNCTIONS_KEY)) { - assertEquals("Header Functions has a wrong value", Integer.valueOf(0), measure.getIntValue()); + assertEquals("Header Functions has a wrong value", 0, measure.getIntValue().intValue()); } else if (s.equals(CoreMetrics.COMPLEXITY_KEY)) { - assertEquals("Header Complexity has a wrong value", Integer.valueOf(0), measure.getIntValue()); + assertEquals("Header Complexity has a wrong value", 0, measure.getIntValue().intValue()); } else if (s.equals(CoreMetrics.FILE_COMPLEXITY_KEY)) { - assertEquals("Header File Complexity has a wrong value", Double.valueOf(0.0d), measure.getValue()); + assertEquals("Header File Complexity has a wrong value", 0.0d, measure.getValue().doubleValue(), 0.0d); } else if (s.equals(CoreMetrics.COMPLEXITY_IN_FUNCTIONS_KEY)) { - assertEquals("Header Complexity in Functions has a wrong value", Integer.valueOf(0), measure.getIntValue()); - } else if (s.equals(CoreMetrics.FUNCTION_COMPLEXITY)) { - assertEquals("Header Functions Complexity has a wrong value", Double.valueOf(0.0d), measure.getValue()); + assertEquals("Header Complexity in Functions has a wrong value", 0, measure.getIntValue().intValue()); + } else if (s.equals(CoreMetrics.FUNCTION_COMPLEXITY_KEY)) { + assertEquals("Header Functions Complexity has a wrong value", 0.0d, measure.getValue().doubleValue(), 0.0d); } - - }*/ + } assertTrue("Key is not there", report.containsKey("VW_R_App/Controller/Accelerate/VWRAccelerationViewController.m")); - - List list2 = report.get("VW_R_App/Controller/Accelerate/VWRAccelerationViewController.h"); - - /*for (Measure measure : list2) { - - org.slf4j.LoggerFactory.getLogger(getClass()).info("{}", measure); - + List list2 = report.get("VW_R_App/Controller/Accelerate/VWRAccelerationViewController.m"); + assertEquals(5, list2.size()); + for (Measure measure : list2) { String s = measure.getMetric().getKey(); if (s.equals(CoreMetrics.FUNCTIONS_KEY)) { - assertEquals("MFile Functions has a wrong value", Integer.valueOf(2), measure.getIntValue()); + assertEquals("MFile Functions has a wrong value", 2, measure.getIntValue().intValue()); } else if (s.equals(CoreMetrics.COMPLEXITY_KEY)) { - assertEquals("MFile Complexity has a wrong value", Integer.valueOf(6), measure.getIntValue()); + assertEquals("MFile Complexity has a wrong value", 6, measure.getIntValue().intValue()); } else if (s.equals(CoreMetrics.FILE_COMPLEXITY_KEY)) { - assertEquals("MFile File Complexity has a wrong value", Double.valueOf(6.0d), measure.getValue()); + assertEquals("MFile File Complexity has a wrong value", 6.0d, measure.getValue().doubleValue(), 0.0d); } else if (s.equals(CoreMetrics.COMPLEXITY_IN_FUNCTIONS_KEY)) { - assertEquals("MFile Complexity in Functions has a wrong value", Integer.valueOf(6), measure.getIntValue()); - } else if (s.equals(CoreMetrics.FUNCTION_COMPLEXITY)) { - assertEquals("MFile Functions Complexity has a wrong value", 3.0d, measure.getValue(), 0.0d); + assertEquals("MFile Complexity in Functions has a wrong value", 6, measure.getIntValue().intValue()); + } else if (s.equals(CoreMetrics.FUNCTION_COMPLEXITY_KEY)) { + assertEquals("MFile Functions Complexity has a wrong value", 3.0d, measure.getValue().doubleValue(), 0.0d); } - - }*/ - + } } @Test - public void parseReportShouldReturnEmptyMapWhenXMLFileIsIncorrect() { + public void parseReportShouldReturnNullWhenXMLFileIsIncorrect() { + LizardReportParser parser = new LizardReportParser(); + + assertNotNull("correct file is null", incorrectFile); + + Map> report = parser.parseReport(incorrectFile); + assertNull("report is not null", report); } From 1dfc0c378b0d421113384e259ad59cdb9220dbc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Gil=20Herrera?= Date: Fri, 5 Jun 2015 09:32:50 +0200 Subject: [PATCH 08/42] saving the file complexity distribution was moved from ObjectiveCSquidSensor to LizardMeasurePersistor --- .../objectivec/ObjectiveCSquidSensor.java | 15 ++++------ .../complexity/LizardMeasurePersistor.java | 28 +++++++++++++++++++ 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java index 8b59781e..a8ce9226 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java @@ -53,7 +53,6 @@ public class ObjectiveCSquidSensor implements Sensor { private final Number[] FUNCTIONS_DISTRIB_BOTTOM_LIMITS = {1, 2, 4, 6, 8, 10, 12, 20, 30}; - private final Number[] FILES_DISTRIB_BOTTOM_LIMITS = {0, 5, 10, 20, 30, 60, 90}; private final AnnotationCheckFactory annotationCheckFactory; @@ -91,7 +90,11 @@ private void save(Collection squidSourceFiles) { File sonarFile = File.fromIOFile(new java.io.File(squidFile.getKey()), project); - saveFilesComplexityDistribution(sonarFile, squidFile); + /* + * Distribution is saved in the Lizard sensor and therefore it is not possible to save the complexity + * distribution here. The method was moved to LizardMeasurePersistor. + */ + //saveFilesComplexityDistribution(sonarFile, squidFile); saveFunctionsComplexityDistribution(sonarFile, squidFile); saveMeasures(sonarFile, squidFile); saveViolations(sonarFile, squidFile); @@ -103,7 +106,7 @@ private void saveMeasures(File sonarFile, SourceFile squidFile) { context.saveMeasure(sonarFile, CoreMetrics.LINES, squidFile.getDouble(ObjectiveCMetric.LINES)); context.saveMeasure(sonarFile, CoreMetrics.NCLOC, squidFile.getDouble(ObjectiveCMetric.LINES_OF_CODE)); /** - * Saving the same measure more than one for a file throws an exception and that is why + * Saving the same measure more than once for a file throws an exception and that is why * CoreMetrics.FUNCTIONS and CoreMetrics.COMPLEXITY are not allowed to be saved here, In order for the * LizardSensor to be able to to its job and save the values for those metrics. */ @@ -122,12 +125,6 @@ private void saveFunctionsComplexityDistribution(File sonarFile, SourceFile squi context.saveMeasure(sonarFile, complexityDistribution.build().setPersistenceMode(PersistenceMode.MEMORY)); } - private void saveFilesComplexityDistribution(File sonarFile, SourceFile squidFile) { - RangeDistributionBuilder complexityDistribution = new RangeDistributionBuilder(CoreMetrics.FILE_COMPLEXITY_DISTRIBUTION, FILES_DISTRIB_BOTTOM_LIMITS); - complexityDistribution.add(squidFile.getDouble(ObjectiveCMetric.COMPLEXITY)); - context.saveMeasure(sonarFile, complexityDistribution.build().setPersistenceMode(PersistenceMode.MEMORY)); - } - private void saveViolations(File sonarFile, SourceFile squidFile) { Collection messages = squidFile.getCheckMessages(); if (messages != null) { diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java index af19c023..f0c80f15 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java @@ -24,10 +24,20 @@ import org.sonar.api.batch.SensorContext; import org.sonar.api.batch.fs.FileSystem; import org.sonar.api.batch.fs.InputFile; +import org.sonar.api.measures.CoreMetrics; import org.sonar.api.measures.Measure; +import org.sonar.api.measures.PersistenceMode; +import org.sonar.api.measures.RangeDistributionBuilder; import org.sonar.api.resources.Project; +import org.sonar.objectivec.api.ObjectiveCMetric; +import org.sonar.squidbridge.api.SourceCode; +import org.sonar.squidbridge.api.SourceFile; +import org.sonar.squidbridge.api.SourceFunction; +import org.sonar.squidbridge.indexer.QueryByParent; +import org.sonar.squidbridge.indexer.QueryByType; import java.io.File; +import java.util.Collection; import java.util.List; import java.util.Map; @@ -37,6 +47,9 @@ */ public class LizardMeasurePersistor { + private final Number[] FUNCTIONS_DISTRIB_BOTTOM_LIMITS = {1, 2, 4, 6, 8, 10, 12, 20, 30}; + private final Number[] FILES_DISTRIB_BOTTOM_LIMITS = {0, 5, 10, 20, 30, 60, 90}; + private Project project; private SensorContext sensorContext; @@ -56,9 +69,24 @@ public void saveMeasures(final Map> measures) { LoggerFactory.getLogger(getClass()).error(" Exception -> {} -> {}", entry.getKey(), measure.getMetric().getName()); } } + saveFilesComplexityDistribution(objcfile); } } + } + + /*private void saveFunctionsComplexityDistribution(org.sonar.api.resources.File sonarFile, SourceFile squidFile) { + Collection squidFunctionsInFile = scanner.getIndex().search(new QueryByParent(squidFile), new QueryByType(SourceFunction.class)); + RangeDistributionBuilder complexityDistribution = new RangeDistributionBuilder(CoreMetrics.FUNCTION_COMPLEXITY_DISTRIBUTION, FUNCTIONS_DISTRIB_BOTTOM_LIMITS); + for (SourceCode squidFunction : squidFunctionsInFile) { + complexityDistribution.add(squidFunction.getDouble(ObjectiveCMetric.COMPLEXITY)); + } + context.saveMeasure(sonarFile, complexityDistribution.build().setPersistenceMode(PersistenceMode.MEMORY)); + }*/ + private void saveFilesComplexityDistribution(org.sonar.api.resources.File sonarFile) { + RangeDistributionBuilder complexityDistribution = new RangeDistributionBuilder(CoreMetrics.FILE_COMPLEXITY_DISTRIBUTION, FILES_DISTRIB_BOTTOM_LIMITS); + complexityDistribution.add(sensorContext.getMeasure(sonarFile, CoreMetrics.FILE_COMPLEXITY).getValue()); + sensorContext.saveMeasure(sonarFile, complexityDistribution.build().setPersistenceMode(PersistenceMode.MEMORY)); } private boolean fileExists(final SensorContext context, From 282ebe6d52ce84735564c0d5260dad1d30cd89b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Gil=20Herrera?= Date: Fri, 5 Jun 2015 10:31:34 +0200 Subject: [PATCH 09/42] File/Function Complexity distribution functionality moved from ObjectiveCSquidSensor to LizardReportParser. --- .../objectivec/ObjectiveCSquidSensor.java | 22 +++----- .../complexity/LizardMeasurePersistor.java | 17 +------ .../complexity/LizardReportParser.java | 51 ++++++++++++------- .../complexity/LizardReportParserTest.java | 4 +- 4 files changed, 43 insertions(+), 51 deletions(-) diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java index a8ce9226..a901ba9b 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java @@ -52,8 +52,6 @@ public class ObjectiveCSquidSensor implements Sensor { - private final Number[] FUNCTIONS_DISTRIB_BOTTOM_LIMITS = {1, 2, 4, 6, 8, 10, 12, 20, 30}; - private final AnnotationCheckFactory annotationCheckFactory; private Project project; @@ -92,10 +90,10 @@ private void save(Collection squidSourceFiles) { /* * Distribution is saved in the Lizard sensor and therefore it is not possible to save the complexity - * distribution here. The method was moved to LizardMeasurePersistor. + * distribution here. The functionality has been moved to LizardParser. */ //saveFilesComplexityDistribution(sonarFile, squidFile); - saveFunctionsComplexityDistribution(sonarFile, squidFile); + //saveFunctionsComplexityDistribution(sonarFile, squidFile); saveMeasures(sonarFile, squidFile); saveViolations(sonarFile, squidFile); } @@ -106,9 +104,10 @@ private void saveMeasures(File sonarFile, SourceFile squidFile) { context.saveMeasure(sonarFile, CoreMetrics.LINES, squidFile.getDouble(ObjectiveCMetric.LINES)); context.saveMeasure(sonarFile, CoreMetrics.NCLOC, squidFile.getDouble(ObjectiveCMetric.LINES_OF_CODE)); /** - * Saving the same measure more than once for a file throws an exception and that is why - * CoreMetrics.FUNCTIONS and CoreMetrics.COMPLEXITY are not allowed to be saved here, In order for the - * LizardSensor to be able to to its job and save the values for those metrics. + * Saving the same measure more than once per file throws exception. That is why + * CoreMetrics.FUNCTIONS and CoreMetrics.COMPLEXITY are not allowed to be saved here. In order for the + * LizardSensor to be able to to its job and save the values for those metrics the functionality has been + * moved to Lizard classes. */ //context.saveMeasure(sonarFile, CoreMetrics.FUNCTIONS, squidFile.getDouble(ObjectiveCMetric.FUNCTIONS)); context.saveMeasure(sonarFile, CoreMetrics.STATEMENTS, squidFile.getDouble(ObjectiveCMetric.STATEMENTS)); @@ -116,15 +115,6 @@ private void saveMeasures(File sonarFile, SourceFile squidFile) { context.saveMeasure(sonarFile, CoreMetrics.COMMENT_LINES, squidFile.getDouble(ObjectiveCMetric.COMMENT_LINES)); } - private void saveFunctionsComplexityDistribution(File sonarFile, SourceFile squidFile) { - Collection squidFunctionsInFile = scanner.getIndex().search(new QueryByParent(squidFile), new QueryByType(SourceFunction.class)); - RangeDistributionBuilder complexityDistribution = new RangeDistributionBuilder(CoreMetrics.FUNCTION_COMPLEXITY_DISTRIBUTION, FUNCTIONS_DISTRIB_BOTTOM_LIMITS); - for (SourceCode squidFunction : squidFunctionsInFile) { - complexityDistribution.add(squidFunction.getDouble(ObjectiveCMetric.COMPLEXITY)); - } - context.saveMeasure(sonarFile, complexityDistribution.build().setPersistenceMode(PersistenceMode.MEMORY)); - } - private void saveViolations(File sonarFile, SourceFile squidFile) { Collection messages = squidFile.getCheckMessages(); if (messages != null) { diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java index f0c80f15..89317936 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java @@ -64,31 +64,16 @@ public void saveMeasures(final Map> measures) { if (fileExists(sensorContext, objcfile)) { for (Measure measure : entry.getValue()) { try { + LoggerFactory.getLogger(getClass()).debug("Save measure {} for file {}", measure.getMetric().getName(), objcfile.getName()); sensorContext.saveMeasure(objcfile, measure); } catch (Exception e) { LoggerFactory.getLogger(getClass()).error(" Exception -> {} -> {}", entry.getKey(), measure.getMetric().getName()); } } - saveFilesComplexityDistribution(objcfile); } } } - /*private void saveFunctionsComplexityDistribution(org.sonar.api.resources.File sonarFile, SourceFile squidFile) { - Collection squidFunctionsInFile = scanner.getIndex().search(new QueryByParent(squidFile), new QueryByType(SourceFunction.class)); - RangeDistributionBuilder complexityDistribution = new RangeDistributionBuilder(CoreMetrics.FUNCTION_COMPLEXITY_DISTRIBUTION, FUNCTIONS_DISTRIB_BOTTOM_LIMITS); - for (SourceCode squidFunction : squidFunctionsInFile) { - complexityDistribution.add(squidFunction.getDouble(ObjectiveCMetric.COMPLEXITY)); - } - context.saveMeasure(sonarFile, complexityDistribution.build().setPersistenceMode(PersistenceMode.MEMORY)); - }*/ - - private void saveFilesComplexityDistribution(org.sonar.api.resources.File sonarFile) { - RangeDistributionBuilder complexityDistribution = new RangeDistributionBuilder(CoreMetrics.FILE_COMPLEXITY_DISTRIBUTION, FILES_DISTRIB_BOTTOM_LIMITS); - complexityDistribution.add(sensorContext.getMeasure(sonarFile, CoreMetrics.FILE_COMPLEXITY).getValue()); - sensorContext.saveMeasure(sonarFile, complexityDistribution.build().setPersistenceMode(PersistenceMode.MEMORY)); - } - private boolean fileExists(final SensorContext context, final org.sonar.api.resources.File file) { return context.getResource(file) != null; diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java index 37e4a39a..e6a017cc 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java @@ -20,9 +20,7 @@ package org.sonar.plugins.objectivec.complexity; import org.slf4j.LoggerFactory; -import org.sonar.api.measures.CoreMetrics; -import org.sonar.api.measures.Measure; -import org.sonar.api.measures.Metric; +import org.sonar.api.measures.*; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -45,6 +43,9 @@ */ public class LizardReportParser { + private final Number[] FUNCTIONS_DISTRIB_BOTTOM_LIMITS = {1, 2, 4, 6, 8, 10, 12, 20, 30}; + private final Number[] FILES_DISTRIB_BOTTOM_LIMITS = {0, 5, 10, 20, 30, 60, 90}; + private static final String MEASURE = "measure"; private static final String MEASURE_TYPE = "type"; private static final String MEASURE_ITEM = "item"; @@ -74,7 +75,7 @@ public Map> parseReport(final File xmlFile) { return result; } - public Map> parseFile(Document document) { + private Map> parseFile(Document document) { final Map> reportMeasures = new HashMap>(); final List functions = new ArrayList(); @@ -87,7 +88,7 @@ public Map> parseFile(Document document) { Element element = (Element) node; if (element.getAttribute(MEASURE_TYPE).equalsIgnoreCase(FILE_MEASURE)) { NodeList itemList = element.getElementsByTagName(MEASURE_ITEM); - addComplexityPerFileMeasure(itemList, reportMeasures); + addComplexityFileMeasures(itemList, reportMeasures); } else if(element.getAttribute(MEASURE_TYPE).equalsIgnoreCase(FUNCTION_MEASURE)) { NodeList itemList = element.getElementsByTagName(MEASURE_ITEM); collectFunctions(itemList, functions); @@ -95,12 +96,12 @@ public Map> parseFile(Document document) { } } - addComplexityPerFunctionMeasure(reportMeasures, functions); + addComplexityFunctionMeasures(reportMeasures, functions); return reportMeasures; } - private void addComplexityPerFileMeasure(NodeList itemList, Map> reportMeasures){ + private void addComplexityFileMeasures(NodeList itemList, Map> reportMeasures){ for (int i = 0; i < itemList.getLength(); i++) { Node item = itemList.item(i); @@ -112,16 +113,22 @@ private void addComplexityPerFileMeasure(NodeList itemList, Map list = new ArrayList(); - list.add(new Measure(CoreMetrics.COMPLEXITY).setIntValue(complexity)); - list.add(new Measure(CoreMetrics.FUNCTIONS).setIntValue(numberOfFunctions)); - list.add(new Measure(CoreMetrics.FILE_COMPLEXITY, fileComplexity)); - - reportMeasures.put(fileName, list); + reportMeasures.put(fileName, buildMeasureList(complexity, fileComplexity, numberOfFunctions)); } } } + private List buildMeasureList(int complexity, double fileComplexity, int numberOfFunctions){ + List list = new ArrayList(); + list.add(new Measure(CoreMetrics.COMPLEXITY).setIntValue(complexity)); + list.add(new Measure(CoreMetrics.FUNCTIONS).setIntValue(numberOfFunctions)); + list.add(new Measure(CoreMetrics.FILE_COMPLEXITY, fileComplexity)); + RangeDistributionBuilder complexityDistribution = new RangeDistributionBuilder(CoreMetrics.FILE_COMPLEXITY_DISTRIBUTION, FILES_DISTRIB_BOTTOM_LIMITS); + complexityDistribution.add(fileComplexity); + list.add(complexityDistribution.build().setPersistenceMode(PersistenceMode.MEMORY)); + return list; + } + private void collectFunctions(NodeList itemList, List functions) { for (int i = 0; i < itemList.getLength(); i++) { Node item = itemList.item(i); @@ -134,20 +141,22 @@ private void collectFunctions(NodeList itemList, List functions) { } } - private void addComplexityPerFunctionMeasure(Map> reportMeasures, List functions){ + private void addComplexityFunctionMeasures(Map> reportMeasures, List functions){ for (Map.Entry> entry : reportMeasures.entrySet()) { + + RangeDistributionBuilder complexityDistribution = new RangeDistributionBuilder(CoreMetrics.FUNCTION_COMPLEXITY_DISTRIBUTION, FUNCTIONS_DISTRIB_BOTTOM_LIMITS); int count = 0; int complexityInFunctions = 0; + for (ObjCFunction func : functions) { if (func.getName().contains(entry.getKey())) { + complexityDistribution.add(func.getCyclomaticComplexity()); count++; complexityInFunctions += func.getCyclomaticComplexity(); } } if (count != 0) { - entry.getValue().add(new Measure(CoreMetrics.COMPLEXITY_IN_FUNCTIONS).setIntValue(complexityInFunctions)); - double complex = 0; for (Measure m : entry.getValue()){ if (m.getMetric().getKey().equalsIgnoreCase(CoreMetrics.FILE_COMPLEXITY.getKey())){ @@ -157,11 +166,19 @@ private void addComplexityPerFunctionMeasure(Map> reportMe } double complexMean = complex/(double)count; - entry.getValue().add(new Measure(CoreMetrics.FUNCTION_COMPLEXITY, complexMean)); + entry.getValue().addAll(buildFuncionMeasuresList(complexMean, complexityInFunctions, complexityDistribution)); } } } + public List buildFuncionMeasuresList(double complexMean, int complexityInFunctions, RangeDistributionBuilder builder){ + List list = new ArrayList(); + list.add(new Measure(CoreMetrics.FUNCTION_COMPLEXITY, complexMean)); + list.add(new Measure(CoreMetrics.COMPLEXITY_IN_FUNCTIONS).setIntValue(complexityInFunctions)); + list.add(builder.build().setPersistenceMode(PersistenceMode.MEMORY)); + return list; + } + private class ObjCFunction { private String name; private int cyclomaticComplexity; diff --git a/src/test/java/org/sonar/plugins/objectivec/complexity/LizardReportParserTest.java b/src/test/java/org/sonar/plugins/objectivec/complexity/LizardReportParserTest.java index 7365340b..0fe88dca 100644 --- a/src/test/java/org/sonar/plugins/objectivec/complexity/LizardReportParserTest.java +++ b/src/test/java/org/sonar/plugins/objectivec/complexity/LizardReportParserTest.java @@ -138,7 +138,7 @@ public void parseReportShouldReturnMapWhenXMLFileIsCorrect() { assertTrue("Key is not there", report.containsKey("VW_R_App/Controller/Accelerate/VWRAccelerationViewController.h")); List list1 = report.get("VW_R_App/Controller/Accelerate/VWRAccelerationViewController.h"); - assertEquals(3, list1.size()); + assertEquals(4, list1.size()); for (Measure measure : list1) { String s = measure.getMetric().getKey(); @@ -159,7 +159,7 @@ public void parseReportShouldReturnMapWhenXMLFileIsCorrect() { assertTrue("Key is not there", report.containsKey("VW_R_App/Controller/Accelerate/VWRAccelerationViewController.m")); List list2 = report.get("VW_R_App/Controller/Accelerate/VWRAccelerationViewController.m"); - assertEquals(5, list2.size()); + assertEquals(7, list2.size()); for (Measure measure : list2) { String s = measure.getMetric().getKey(); From 0871e46c178f3a83e3058a0fe6a72b56504e6a53 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Gil=20Herrera?= Date: Fri, 5 Jun 2015 10:43:43 +0200 Subject: [PATCH 10/42] changed one script line that was unintentionally modified --- src/main/shell/run-sonar.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main/shell/run-sonar.sh b/src/main/shell/run-sonar.sh index 6024e5b0..e4e9f68b 100755 --- a/src/main/shell/run-sonar.sh +++ b/src/main/shell/run-sonar.sh @@ -165,8 +165,7 @@ srcDirs=''; readParameter srcDirs 'sonar.sources' appScheme=''; readParameter appScheme 'sonar.objectivec.appScheme' # The name of your test scheme in Xcode -testScheme=''; readParameter testScheme ' -c.testScheme' +testScheme=''; readParameter testScheme 'sonar.objectivec.testScheme' # The file patterns to exclude from coverage report excludedPathsFromCoverage=''; readParameter excludedPathsFromCoverage 'sonar.objectivec.excludedPathsFromCoverage' From 6df19c10e755eb98c830053f5ff692f346bd70da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Gil=20Herrera?= Date: Fri, 5 Jun 2015 10:46:18 +0200 Subject: [PATCH 11/42] constants from LizardMeasurePersistor deleted --- .../plugins/objectivec/complexity/LizardMeasurePersistor.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java index 89317936..30d4eab7 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java @@ -47,9 +47,6 @@ */ public class LizardMeasurePersistor { - private final Number[] FUNCTIONS_DISTRIB_BOTTOM_LIMITS = {1, 2, 4, 6, 8, 10, 12, 20, 30}; - private final Number[] FILES_DISTRIB_BOTTOM_LIMITS = {0, 5, 10, 20, 30, 60, 90}; - private Project project; private SensorContext sensorContext; From 9b39d535c8547f76d0a27ce78d6769efb763b380 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Gil=20Herrera?= Date: Fri, 5 Jun 2015 10:59:25 +0200 Subject: [PATCH 12/42] dependency for xml parser and optimize imports in LizardMeasurePersistor.java --- pom.xml | 5 +++++ .../complexity/LizardMeasurePersistor.java | 13 ------------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index 8cf7bd1e..3df5fc60 100644 --- a/pom.xml +++ b/pom.xml @@ -182,6 +182,11 @@ sonar-surefire-plugin 2.7 + + xml-apis + xml-apis + 1.0.b2 + diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java index 30d4eab7..909feaa4 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java @@ -20,24 +20,11 @@ package org.sonar.plugins.objectivec.complexity; import org.slf4j.LoggerFactory; -import org.sonar.api.batch.DecoratorContext; import org.sonar.api.batch.SensorContext; -import org.sonar.api.batch.fs.FileSystem; -import org.sonar.api.batch.fs.InputFile; -import org.sonar.api.measures.CoreMetrics; import org.sonar.api.measures.Measure; -import org.sonar.api.measures.PersistenceMode; -import org.sonar.api.measures.RangeDistributionBuilder; import org.sonar.api.resources.Project; -import org.sonar.objectivec.api.ObjectiveCMetric; -import org.sonar.squidbridge.api.SourceCode; -import org.sonar.squidbridge.api.SourceFile; -import org.sonar.squidbridge.api.SourceFunction; -import org.sonar.squidbridge.indexer.QueryByParent; -import org.sonar.squidbridge.indexer.QueryByType; import java.io.File; -import java.util.Collection; import java.util.List; import java.util.Map; From 2606f7b55136b5a043f374e274298832fa6e7192 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Gil=20Herrera?= Date: Fri, 5 Jun 2015 11:13:31 +0200 Subject: [PATCH 13/42] loggs --- .../plugins/objectivec/complexity/LizardMeasurePersistor.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java index 909feaa4..5e049ff1 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java @@ -48,7 +48,7 @@ public void saveMeasures(final Map> measures) { if (fileExists(sensorContext, objcfile)) { for (Measure measure : entry.getValue()) { try { - LoggerFactory.getLogger(getClass()).debug("Save measure {} for file {}", measure.getMetric().getName(), objcfile.getName()); + LoggerFactory.getLogger(getClass()).debug("Save measure {} for file {}", measure.getMetric().getName(), objcfile); sensorContext.saveMeasure(objcfile, measure); } catch (Exception e) { LoggerFactory.getLogger(getClass()).error(" Exception -> {} -> {}", entry.getKey(), measure.getMetric().getName()); From f8bf77ca2a68ede21211f39d4d3142afd64bb552 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Gil=20Herrera?= Date: Fri, 5 Jun 2015 12:44:50 +0200 Subject: [PATCH 14/42] tests updated --- .../complexity/LizardReportParserTest.java | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/test/java/org/sonar/plugins/objectivec/complexity/LizardReportParserTest.java b/src/test/java/org/sonar/plugins/objectivec/complexity/LizardReportParserTest.java index 0fe88dca..d58d788b 100644 --- a/src/test/java/org/sonar/plugins/objectivec/complexity/LizardReportParserTest.java +++ b/src/test/java/org/sonar/plugins/objectivec/complexity/LizardReportParserTest.java @@ -63,9 +63,9 @@ public File createCorrectFile() throws IOException { //root object and measure out.write(""); //items for function - out.write(""); + out.write(""); out.write("2151"); - out.write(""); + out.write(""); out.write("3205"); //average and close funciton measure out.write(""); @@ -74,9 +74,9 @@ public File createCorrectFile() throws IOException { //open file measure and add the labels out.write(""); //items for file - out.write(""); + out.write(""); out.write("1200"); - out.write(""); + out.write(""); out.write("286862"); //add averages out.write(""); @@ -99,9 +99,9 @@ public File createIncorrectFile() throws IOException { //root object and measure out.write(""); //items for function - out.write(""); + out.write(""); out.write("2151"); - out.write(""); + out.write(""); out.write("3205"); //average and close funciton measure out.write(""); @@ -110,9 +110,9 @@ public File createIncorrectFile() throws IOException { //open file measure and add the labels out.write(""); //items for file 3th value tag has no closing tag - out.write(""); + out.write(""); out.write("1200"); - out.write(""); + out.write(""); out.write("286862"); //add averages out.write(""); @@ -136,8 +136,8 @@ public void parseReportShouldReturnMapWhenXMLFileIsCorrect() { assertNotNull("report is null", report); - assertTrue("Key is not there", report.containsKey("VW_R_App/Controller/Accelerate/VWRAccelerationViewController.h")); - List list1 = report.get("VW_R_App/Controller/Accelerate/VWRAccelerationViewController.h"); + assertTrue("Key is not there", report.containsKey("App/Controller/Accelerate/AccelerationViewController.h")); + List list1 = report.get("App/Controller/Accelerate/AccelerationViewController.h"); assertEquals(4, list1.size()); for (Measure measure : list1) { @@ -156,9 +156,9 @@ public void parseReportShouldReturnMapWhenXMLFileIsCorrect() { } } - assertTrue("Key is not there", report.containsKey("VW_R_App/Controller/Accelerate/VWRAccelerationViewController.m")); + assertTrue("Key is not there", report.containsKey("App/Controller/Accelerate/AccelerationViewController.m")); - List list2 = report.get("VW_R_App/Controller/Accelerate/VWRAccelerationViewController.m"); + List list2 = report.get("App/Controller/Accelerate/AccelerationViewController.m"); assertEquals(7, list2.size()); for (Measure measure : list2) { String s = measure.getMetric().getKey(); From 0f31327f94c1fe33e04e98d1ad5f1bca75865d9c Mon Sep 17 00:00:00 2001 From: Andres Gil Herrera Date: Sun, 14 Jun 2015 08:22:21 +0200 Subject: [PATCH 15/42] comments --- .../complexity/LizardMeasurePersistor.java | 12 +++++ .../complexity/LizardReportParser.java | 48 +++++++++++++++++++ .../objectivec/complexity/LizardSensor.java | 24 +++++++++- .../complexity/LizardReportParserTest.java | 16 +++++++ .../complexity/LizardSensorTest.java | 6 +++ 5 files changed, 105 insertions(+), 1 deletion(-) diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java index 5e049ff1..709e5e8d 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java @@ -29,6 +29,8 @@ import java.util.Map; /** + * This class is used to save the measures created by the lizardReportParser in the sonar database + * * @author Andres Gil Herrera * @since 28/05/15. */ @@ -42,6 +44,10 @@ public LizardMeasurePersistor(final Project p, final SensorContext c) { this.sensorContext = c; } + /** + * + * @param measures Map containing as key the name of the file and as value a list containing the measures for that file + */ public void saveMeasures(final Map> measures) { for (Map.Entry> entry : measures.entrySet()) { final org.sonar.api.resources.File objcfile = org.sonar.api.resources.File.fromIOFile(new File(project.getFileSystem().getBasedir(), entry.getKey()), project); @@ -58,6 +64,12 @@ public void saveMeasures(final Map> measures) { } } + /** + * + * @param context context of the sensor + * @param file file to prove for + * @return true if the resource is indexed and false if not + */ private boolean fileExists(final SensorContext context, final org.sonar.api.resources.File file) { return context.getResource(file) != null; diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java index e6a017cc..3752b61d 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java @@ -38,6 +38,10 @@ import java.util.Map; /** + * This class parses xml Reports form the tool Lizard in order to extract this measures: + * COMPLEXITY, FUNCTIONS, FUNCTION_COMPLEXITY, FUNCTION_COMPLEXITY_DISTRIBUTION, + * FILE_COMPLEXITY, FUNCTION_COMPLEXITY_DISTRIBUTION, COMPLEXITY_IN_FUNCTIONS + * * @author Andres Gil Herrera * @since 28/05/15 */ @@ -56,6 +60,11 @@ public class LizardReportParser { private static final int CYCLOMATIC_COMPLEXITY_INDEX = 2; private static final int FUNCTIONS_INDEX = 3; + /** + * + * @param xmlFile lizard xml report + * @return Map containing as key the name of the file and as value a list containing the measures for that file + */ public Map> parseReport(final File xmlFile) { Map> result = null; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); @@ -75,6 +84,11 @@ public Map> parseReport(final File xmlFile) { return result; } + /** + * + * @param document Document object representing the lizard report + * @return Map containing as key the name of the file and as value a list containing the measures for that file + */ private Map> parseFile(Document document) { final Map> reportMeasures = new HashMap>(); final List functions = new ArrayList(); @@ -101,6 +115,12 @@ private Map> parseFile(Document document) { return reportMeasures; } + /** + * This method extracts the values for COMPLEXITY, FUNCTIONS, FILE_COMPLEXITY + * + * @param itemList list of all items from a + * @param reportMeasures map to save the measures for each file + */ private void addComplexityFileMeasures(NodeList itemList, Map> reportMeasures){ for (int i = 0; i < itemList.getLength(); i++) { Node item = itemList.item(i); @@ -118,6 +138,13 @@ private void addComplexityFileMeasures(NodeList itemList, Map buildMeasureList(int complexity, double fileComplexity, int numberOfFunctions){ List list = new ArrayList(); list.add(new Measure(CoreMetrics.COMPLEXITY).setIntValue(complexity)); @@ -129,6 +156,11 @@ private List buildMeasureList(int complexity, double fileComplexity, in return list; } + /** + * + * @param itemList NodeList of all items in a tag + * @param functions list to save the functions in the NodeList as ObjCFunction objects. + */ private void collectFunctions(NodeList itemList, List functions) { for (int i = 0; i < itemList.getLength(); i++) { Node item = itemList.item(i); @@ -141,6 +173,12 @@ private void collectFunctions(NodeList itemList, List functions) { } } + /** + * + * @param reportMeasures map to save the measures for the different files + * @param functions list of ObjCFunction to extract the information needed to create + * FUNCTION_COMPLEXITY_DISTRIBUTION, FUNCTION_COMPLEXITY, COMPLEXITY_IN_FUNCTIONS + */ private void addComplexityFunctionMeasures(Map> reportMeasures, List functions){ for (Map.Entry> entry : reportMeasures.entrySet()) { @@ -171,6 +209,13 @@ private void addComplexityFunctionMeasures(Map> reportMeas } } + /** + * + * @param complexMean average complexity per function in a file + * @param complexityInFunctions Entire complexity in functions + * @param builder Builder ready to build FUNCTION_COMPLEXITY_DISTRIBUTION + * @return list of Measures containing FUNCTION_COMPLEXITY_DISTRIBUTION, FUNCTION_COMPLEXITY and COMPLEXITY_IN_FUNCTIONS + */ public List buildFuncionMeasuresList(double complexMean, int complexityInFunctions, RangeDistributionBuilder builder){ List list = new ArrayList(); list.add(new Measure(CoreMetrics.FUNCTION_COMPLEXITY, complexMean)); @@ -179,6 +224,9 @@ public List buildFuncionMeasuresList(double complexMean, int complexity return list; } + /** + * helper class to process the information the functions contained in a Lizard report + */ private class ObjCFunction { private String name; private int cyclomaticComplexity; diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java index 30f3e512..83dff372 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java @@ -35,6 +35,9 @@ import java.util.Map; /** + * This sensor searches for the report generated from the tool Lizard + * in order to save complexity metrics. + * * @author Andres Gil Herrera * @since 28/05/15 */ @@ -53,11 +56,21 @@ public LizardSensor(final FileSystem moduleFileSystem, final Settings config) { this.fileSystem = moduleFileSystem; } + /** + * + * @param project + * @return true if the project is root the root project and uses Objective-C + */ @Override public boolean shouldExecuteOnProject(Project project) { return project.isRoot() && fileSystem.languages().contains(ObjectiveC.KEY); } + /** + * + * @param project + * @param sensorContext + */ @Override public void analyse(Project project, SensorContext sensorContext) { final String projectBaseDir = project.getFileSystem().getBasedir().getPath(); @@ -65,7 +78,12 @@ public void analyse(Project project, SensorContext sensorContext) { new LizardMeasurePersistor(project, sensorContext).saveMeasures(measures); } - //key = file name + /** + * + * @param baseDir base directory of the project to search the report + * @param parser LizardReportParser to parse the report + * @return Map containing as key the name of the file and as value a list containing the measures for that file + */ private Map> parseReportsIn(final String baseDir, LizardReportParser parser) { final StringBuilder reportFileName = new StringBuilder(baseDir); reportFileName.append("/").append(reportPath()); @@ -73,6 +91,10 @@ private Map> parseReportsIn(final String baseDir, LizardRe return parser.parseReport(new File(reportFileName.toString())); } + /** + * + * @return the default report path or the one specified in the sonar-project.properties + */ private String reportPath() { String reportPath = conf.getString(REPORT_PATH_KEY); if (reportPath == null) { diff --git a/src/test/java/org/sonar/plugins/objectivec/complexity/LizardReportParserTest.java b/src/test/java/org/sonar/plugins/objectivec/complexity/LizardReportParserTest.java index d58d788b..43bc8518 100644 --- a/src/test/java/org/sonar/plugins/objectivec/complexity/LizardReportParserTest.java +++ b/src/test/java/org/sonar/plugins/objectivec/complexity/LizardReportParserTest.java @@ -54,6 +54,11 @@ public void setup() throws IOException { incorrectFile = createIncorrectFile(); } + /** + * + * @return dummy lizard xml report to test the parser + * @throws IOException + */ public File createCorrectFile() throws IOException { File xmlFile = folder.newFile("correctFile.xml"); BufferedWriter out = new BufferedWriter(new FileWriter(xmlFile)); @@ -90,6 +95,11 @@ public File createCorrectFile() throws IOException { return xmlFile; } + /** + * + * @return corrupted dummy lizard report to test the parser + * @throws IOException + */ public File createIncorrectFile() throws IOException { File xmlFile = folder.newFile("incorrectFile.xml"); BufferedWriter out = new BufferedWriter(new FileWriter(xmlFile)); @@ -126,6 +136,9 @@ public File createIncorrectFile() throws IOException { return xmlFile; } + /** + * this test case test that the parser extract all measures right + */ @Test public void parseReportShouldReturnMapWhenXMLFileIsCorrect() { LizardReportParser parser = new LizardReportParser(); @@ -177,6 +190,9 @@ public void parseReportShouldReturnMapWhenXMLFileIsCorrect() { } } + /** + * this method test that the parser shoud not return anything if the xml report is corrupted + */ @Test public void parseReportShouldReturnNullWhenXMLFileIsIncorrect() { LizardReportParser parser = new LizardReportParser(); diff --git a/src/test/java/org/sonar/plugins/objectivec/complexity/LizardSensorTest.java b/src/test/java/org/sonar/plugins/objectivec/complexity/LizardSensorTest.java index 15774fa9..55748d17 100644 --- a/src/test/java/org/sonar/plugins/objectivec/complexity/LizardSensorTest.java +++ b/src/test/java/org/sonar/plugins/objectivec/complexity/LizardSensorTest.java @@ -48,6 +48,9 @@ public void setUp() { settings = new Settings(); } + /** + * this method tests that the sensor should be executed when a project is a root project and uses objective c + */ @Test public void shouldExecuteOnProjectShouldBeTrueWhenProjectIsObjc() { final Project project = new Project("Test"); @@ -62,6 +65,9 @@ public void shouldExecuteOnProjectShouldBeTrueWhenProjectIsObjc() { assertTrue(testedSensor.shouldExecuteOnProject(project)); } + /** + * this method tests that the sensor does not get executed when a project dont uses objective c + */ @Test public void shouldExecuteOnProjectShouldBeFalseWhenProjectIsSomethingElse() { final Project project = new Project("Test"); From 42ba9655e8af7a744c2f1bc6e0b464502d465383 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Gil=20Herrera?= Date: Thu, 18 Jun 2015 10:29:49 +0200 Subject: [PATCH 16/42] run lizard just if turned on AND installed --- src/main/shell/run-sonar.sh | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/shell/run-sonar.sh b/src/main/shell/run-sonar.sh index e4e9f68b..cd7f8ee6 100755 --- a/src/main/shell/run-sonar.sh +++ b/src/main/shell/run-sonar.sh @@ -295,12 +295,16 @@ else fi if [ "$lizard" = "on" ]; then + if hash lizard 2>/dev/null; then + # Lizard + echo -n 'Running Lizard...' - # Lizard - echo -n 'Running Lizard...' + # Run Lizard with xml output option and write the output in sonar-reports/lizard-report.xml + lizard --xml "$srcDirs" > sonar-reports/lizard-report.xml + else + echo 'Skipping Lizard (not installed!)' + fi - # Run Lizard with xml output option and write the output in sonar-reports/lizard-report.xml - lizard --xml "$srcDirs" > sonar-reports/lizard-report.xml else echo 'Skipping Lizard (test purposes only!)' fi From 253f26895a4bfc989c735b57beae67a8606b5c54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Gil=20Herrera?= Date: Tue, 30 Jun 2015 09:41:59 +0200 Subject: [PATCH 17/42] small changes that do not break the excecution of the sunar runner if the lizard report is not found, allowing the execution of the plugin without lizard --- .../objectivec/complexity/LizardMeasurePersistor.java | 5 +++++ .../objectivec/complexity/LizardReportParser.java | 9 ++++++--- .../plugins/objectivec/complexity/LizardSensor.java | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java index 709e5e8d..eeee8279 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java @@ -49,6 +49,11 @@ public LizardMeasurePersistor(final Project p, final SensorContext c) { * @param measures Map containing as key the name of the file and as value a list containing the measures for that file */ public void saveMeasures(final Map> measures) { + + if (measures == null) { + return; + } + for (Map.Entry> entry : measures.entrySet()) { final org.sonar.api.resources.File objcfile = org.sonar.api.resources.File.fromIOFile(new File(project.getFileSystem().getBasedir(), entry.getKey()), project); if (fileExists(sensorContext, objcfile)) { diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java index 3752b61d..3a4daf5a 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java @@ -31,6 +31,7 @@ import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; import java.io.File; +import java.io.FileNotFoundException; import java.io.IOException; import java.util.ArrayList; import java.util.HashMap; @@ -73,11 +74,13 @@ public Map> parseReport(final File xmlFile) { DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.parse(xmlFile); result = parseFile(document); + } catch (final FileNotFoundException e){ + LoggerFactory.getLogger(getClass()).error("Lizard Report not found {}", xmlFile, e); } catch (final IOException e) { LoggerFactory.getLogger(getClass()).error("Error processing file named {}", xmlFile, e); - } catch (ParserConfigurationException e) { - LoggerFactory.getLogger(getClass()).error("Error processing file named {}", xmlFile, e); - } catch (SAXException e) { + } catch (final ParserConfigurationException e) { + LoggerFactory.getLogger(getClass()).error("Error parsing file named {}", xmlFile, e); + } catch (final SAXException e) { LoggerFactory.getLogger(getClass()).error("Error processing file named {}", xmlFile, e); } diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java index 83dff372..7e1a03aa 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java @@ -75,6 +75,7 @@ public boolean shouldExecuteOnProject(Project project) { public void analyse(Project project, SensorContext sensorContext) { final String projectBaseDir = project.getFileSystem().getBasedir().getPath(); Map> measures = parseReportsIn(projectBaseDir, new LizardReportParser()); + LoggerFactory.getLogger(getClass()).info("Saving results of complexity analysis"); new LizardMeasurePersistor(project, sensorContext).saveMeasures(measures); } From b832b7be76bbc98e6d5a7119788cfc1acf794390 Mon Sep 17 00:00:00 2001 From: Andres Date: Tue, 30 Jun 2015 13:45:43 +0200 Subject: [PATCH 18/42] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index b2dde7f1..5387ac7b 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ Find below an example of an iOS SonarQube dashboard: ###Features -- [ ] Complexity +- [x] Complexity - [ ] Design - [x] Documentation - [x] Duplications @@ -45,6 +45,7 @@ In the worst case, the Maven repository with all snapshots and releases is avail - [xctool](https://github.com/facebook/xctool) ([HomeBrew](http://brew.sh) installed and ```brew install xctool```). If you are using Xcode 6, make sure to update xctool (```brew upgrade xctool```) to a version > 0.2.2. - [OCLint](http://docs.oclint.org/en/dev/intro/installation.html) installed. Version 0.8.1 recommended ([HomeBrew](http://brew.sh) installed and ```brew install https://gist.githubusercontent.com/TonyAnhTran/e1522b93853c5a456b74/raw/157549c7a77261e906fb88bc5606afd8bd727a73/oclint.rb```). - [gcovr](http://gcovr.com) installed +- [lizard](https://github.com/terryyin/lizard) installed ###Installation (once for all your Objective-C projects) - Install [the plugin](http://bit.ly/18A7OkE) through the Update Center (of SonarQube) or download it into the $SONARQUBE_HOME/extensions/plugins directory @@ -76,6 +77,7 @@ If you still have *run-sonar.sh* file in each of your project (not recommended), * **Mete Balci** ###History +- v0.4.1 (2015/05): added support for Lizard to implement complexity metrics. - v0.4.0 (2015/01): support for SonarQube >= 4.3 (4.x & 5.x) - v0.3.1 (2013/10): fix release - v0.3 (2013/10): added support for OCUnit tests and test coverage From 1c6cfa64369347caa5e9df3c7e424c97998022ca Mon Sep 17 00:00:00 2001 From: Matthew DeTullio Date: Mon, 2 Nov 2015 22:12:29 -0500 Subject: [PATCH 19/42] Update version in POM to 0.5.0-SNAPSHOT --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 3df5fc60..2a794ce6 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ org.codehaus.sonar-plugin.objectivec sonar-objective-c-plugin - 0.4.0 + 0.5.0-SNAPSHOT sonar-plugin From fcc835e52535b48afe4bb4c3951b8119ed0bc97c Mon Sep 17 00:00:00 2001 From: Matthew DeTullio Date: Tue, 20 Oct 2015 14:39:42 -0400 Subject: [PATCH 20/42] Properly handle absolute paths for sonar.objectivec.lizard.report. --- .../sonar/plugins/objectivec/complexity/LizardSensor.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java index 7e1a03aa..168f11a9 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java @@ -86,8 +86,11 @@ public void analyse(Project project, SensorContext sensorContext) { * @return Map containing as key the name of the file and as value a list containing the measures for that file */ private Map> parseReportsIn(final String baseDir, LizardReportParser parser) { - final StringBuilder reportFileName = new StringBuilder(baseDir); - reportFileName.append("/").append(reportPath()); + final StringBuilder reportFileName = new StringBuilder(); + if (!(new File(reportPath()).isAbsolute())) { + reportFileName.append(baseDir).append("/"); + } + reportFileName.append(reportPath()); LoggerFactory.getLogger(getClass()).info("Processing complexity report "); return parser.parseReport(new File(reportFileName.toString())); } From 8d6cab0a788d55423ca5f05bcbeb74ebe71df1a1 Mon Sep 17 00:00:00 2001 From: Matthew DeTullio Date: Wed, 21 Oct 2015 21:45:37 -0400 Subject: [PATCH 21/42] Implement sensor to import Clang static analyzer multi-plist output. Intended to be used with xcodebuild's 'analyze' action, allows setting the sonar.objectivec.clang.reportsPath property to the directory containing the Clang plist report files. --- pom.xml | 7 +- .../plugins/objectivec/ObjectiveCPlugin.java | 5 + .../objectivec/issues/ClangPlistParser.java | 121 ++++++++++++ .../issues/ClangRulesDefinition.java | 50 +++++ .../objectivec/issues/ClangSensor.java | 107 +++++++++++ .../objectivec/issues/ClangWarning.java | 64 +++++++ .../resources/com/sonar/sqale/clang-model.xml | 172 ++++++++++++++++++ .../sonar/plugins/objectivec/rules-clang.xml | 9 + 8 files changed, 534 insertions(+), 1 deletion(-) create mode 100644 src/main/java/org/sonar/plugins/objectivec/issues/ClangPlistParser.java create mode 100644 src/main/java/org/sonar/plugins/objectivec/issues/ClangRulesDefinition.java create mode 100644 src/main/java/org/sonar/plugins/objectivec/issues/ClangSensor.java create mode 100644 src/main/java/org/sonar/plugins/objectivec/issues/ClangWarning.java create mode 100644 src/main/resources/com/sonar/sqale/clang-model.xml create mode 100644 src/main/resources/org/sonar/plugins/objectivec/rules-clang.xml diff --git a/pom.xml b/pom.xml index 2a794ce6..2138e115 100644 --- a/pom.xml +++ b/pom.xml @@ -144,7 +144,7 @@ org.codehaus.sonar.sslr-squid-bridge sslr-squid-bridge - 2.4 + 2.5.3 ant @@ -188,6 +188,11 @@ 1.0.b2 + + com.googlecode.plist + dd-plist + 1.16 + diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java index 3debe84a..4916f9c5 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java @@ -34,6 +34,8 @@ import com.google.common.collect.ImmutableList; +import org.sonar.plugins.objectivec.issues.ClangRulesDefinition; +import org.sonar.plugins.objectivec.issues.ClangSensor; import org.sonar.plugins.objectivec.tests.SurefireSensor; import org.sonar.plugins.objectivec.violations.OCLintProfile; import org.sonar.plugins.objectivec.violations.OCLintProfileImporter; @@ -59,6 +61,9 @@ public List> getExtensions() { CoberturaSensor.class, + ClangRulesDefinition.class, + ClangSensor.class, + OCLintRuleRepository.class, OCLintSensor.class, OCLintProfile.class, diff --git a/src/main/java/org/sonar/plugins/objectivec/issues/ClangPlistParser.java b/src/main/java/org/sonar/plugins/objectivec/issues/ClangPlistParser.java new file mode 100644 index 00000000..cb1d2a1b --- /dev/null +++ b/src/main/java/org/sonar/plugins/objectivec/issues/ClangPlistParser.java @@ -0,0 +1,121 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.plugins.objectivec.issues; + +import com.dd.plist.PropertyListFormatException; +import com.dd.plist.XMLPropertyListParser; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sonar.api.utils.XmlParserException; +import org.xml.sax.SAXException; + +import javax.xml.parsers.ParserConfigurationException; +import java.io.File; +import java.io.FilenameFilter; +import java.io.IOException; +import java.text.ParseException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +/** + * @author Matthew DeTullio + */ +public class ClangPlistParser { + private static final Logger LOGGER = LoggerFactory.getLogger(ClangPlistParser.class.getName()); + + public static List parse(File reportsDir) { + List result = new ArrayList(); + + File[] reports = getReports(reportsDir); + + for (File report : reports) { + try { + result.addAll(parsePlist(report)); + } catch (Exception e) { + throw new XmlParserException("Unable to parse Clang reports", e); + } + } + + return result; + } + + private static File[] getReports(final File reportsDir) { + if (reportsDir == null || !reportsDir.isDirectory() || !reportsDir.exists()) { + return new File[0]; + } + + return reportsDir.listFiles(new FilenameFilter() { + public boolean accept(File dir, String name) { + return name.endsWith(".plist"); + } + }); + } + + @SuppressWarnings("unchecked") + private static List parsePlist(final File file) { + List result = new ArrayList(); + + try { + // Clang report is NSDictionary, which converts to a Map + Map report = + (Map) XMLPropertyListParser.parse(file).toJavaObject(); + + // Files reported on in this report + List files = new ArrayList(); + for (Object obj : (Object[]) report.get("files")) { + files.add((String) obj); + } + + // Diagnostics which contain the warning and the execution path + // (we're only interested in the final location) + List> diagnostics = new ArrayList>(); + for (Object obj : (Object[]) report.get("diagnostics")) { + diagnostics.add((Map) obj); + } + + // Extract warning type, line number, and file, then add to results + for (Map diagnostic : diagnostics) { + Map location = (Map) diagnostic.get("location"); + + ClangWarning clangWarning = new ClangWarning(); + clangWarning.setCategory((String) diagnostic.get("category")); + // file is an integer representing the index of the file in the files array + clangWarning.setFile(new File(files.get((Integer) location.get("file")))); + clangWarning.setLine((Integer) location.get("line")); + clangWarning.setType((String) diagnostic.get("type")); + + result.add(clangWarning); + } + } catch (final IOException e) { + LOGGER.error("Error processing file named {}", file, e); + } catch (final ParserConfigurationException e) { + LOGGER.error("Error processing file named {}", file, e); + } catch (final ParseException e) { + LOGGER.error("Error processing file named {}", file, e); + } catch (final SAXException e) { + LOGGER.error("Error processing file named {}", file, e); + } catch (final PropertyListFormatException e) { + LOGGER.error("Error processing file named {}", file, e); + } + + return result; + } +} diff --git a/src/main/java/org/sonar/plugins/objectivec/issues/ClangRulesDefinition.java b/src/main/java/org/sonar/plugins/objectivec/issues/ClangRulesDefinition.java new file mode 100644 index 00000000..10e0c1ba --- /dev/null +++ b/src/main/java/org/sonar/plugins/objectivec/issues/ClangRulesDefinition.java @@ -0,0 +1,50 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.plugins.objectivec.issues; + +import org.sonar.api.server.rule.RulesDefinition; +import org.sonar.api.server.rule.RulesDefinitionXmlLoader; +import org.sonar.plugins.objectivec.core.ObjectiveC; +import org.sonar.squidbridge.rules.SqaleXmlLoader; + +/** + * @author Matthew DeTullio + */ +public class ClangRulesDefinition implements RulesDefinition { + public static final String REPOSITORY_KEY = "clang"; + public static final String REPOSITORY_NAME = "Clang"; + + @Override + public void define(Context context) { + NewRepository repository = context + .createRepository(REPOSITORY_KEY, ObjectiveC.KEY) + .setName(REPOSITORY_NAME); + + RulesDefinitionXmlLoader ruleLoader = new RulesDefinitionXmlLoader(); + ruleLoader.load( + repository, + ClangRulesDefinition.class.getResourceAsStream("/org/sonar/plugins/objectivec/rules-clang.xml"), + "UTF-8"); + + SqaleXmlLoader.load(repository, "/com/sonar/sqale/clang-model.xml"); + + repository.done(); + } +} diff --git a/src/main/java/org/sonar/plugins/objectivec/issues/ClangSensor.java b/src/main/java/org/sonar/plugins/objectivec/issues/ClangSensor.java new file mode 100644 index 00000000..e0ac5e5b --- /dev/null +++ b/src/main/java/org/sonar/plugins/objectivec/issues/ClangSensor.java @@ -0,0 +1,107 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.plugins.objectivec.issues; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sonar.api.batch.Sensor; +import org.sonar.api.batch.SensorContext; +import org.sonar.api.batch.fs.FileSystem; +import org.sonar.api.component.ResourcePerspectives; +import org.sonar.api.config.Settings; +import org.sonar.api.issue.Issuable; +import org.sonar.api.issue.Issue; +import org.sonar.api.profiles.RulesProfile; +import org.sonar.api.resources.Project; +import org.sonar.api.resources.Resource; +import org.sonar.api.rule.RuleKey; +import org.sonar.plugins.objectivec.ObjectiveCPlugin; +import org.sonar.plugins.objectivec.core.ObjectiveC; + +import java.io.File; +import java.util.List; + +/** + * @author Matthew DeTullio + */ +public class ClangSensor implements Sensor { + private static final Logger LOGGER = LoggerFactory.getLogger(ClangSensor.class.getName()); + + private static final String REPORT_PATH_KEY = ObjectiveCPlugin.PROPERTY_PREFIX + ".clang.reportsPath"; + + private FileSystem fileSystem; + private ResourcePerspectives resourcePerspectives; + private RulesProfile rulesProfile; + private Settings settings; + + public ClangSensor(FileSystem fileSystem, ResourcePerspectives resourcePerspectives, RulesProfile rulesProfile, Settings settings) { + this.fileSystem = fileSystem; + this.resourcePerspectives = resourcePerspectives; + this.rulesProfile = rulesProfile; + this.settings = settings; + } + + @Override + public boolean shouldExecuteOnProject(Project project) { + return project.isRoot() && fileSystem.hasFiles(fileSystem.predicates().hasLanguage(ObjectiveC.KEY)) + && !rulesProfile.getActiveRulesByRepository(ClangRulesDefinition.REPOSITORY_KEY).isEmpty(); + } + + @Override + public void analyse(Project project, SensorContext context) { + String reportPath = settings.getString(REPORT_PATH_KEY); + if (reportPath == null) { + return; + } + + LOGGER.info("Processing Clang reports path: {}", reportPath); + + List clangWarnings = ClangPlistParser.parse(new File(reportPath)); + + for (ClangWarning clangWarning : clangWarnings) { + // TODO: Add check for enabled rule if/when rules get split up + + Resource resource = context.getResource( + org.sonar.api.resources.File.fromIOFile(clangWarning.getFile(), project)); + + if (resource == null) { + LOGGER.debug("Skipping file (not found in index): {}", clangWarning.getFile().getPath()); + continue; + } + + Issuable issuable = resourcePerspectives.as(Issuable.class, resource); + + if (issuable != null) { + Issue issue = issuable.newIssueBuilder() + .ruleKey(RuleKey.of(ClangRulesDefinition.REPOSITORY_KEY, "other")) + .message(String.format("%s - %s", clangWarning.getCategory(), clangWarning.getType())) + .line(clangWarning.getLine()) + .build(); + + issuable.addIssue(issue); + } + } + } + + @Override + public String toString() { + return "Objective-C Clang Sensor"; + } +} diff --git a/src/main/java/org/sonar/plugins/objectivec/issues/ClangWarning.java b/src/main/java/org/sonar/plugins/objectivec/issues/ClangWarning.java new file mode 100644 index 00000000..ccb708be --- /dev/null +++ b/src/main/java/org/sonar/plugins/objectivec/issues/ClangWarning.java @@ -0,0 +1,64 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.plugins.objectivec.issues; + +import java.io.File; + +/** + * @author Matthew DeTullio + */ +public class ClangWarning { + private String category; + private File file; + private Integer line; + private String type; + + public String getCategory() { + return category; + } + + public void setCategory(String category) { + this.category = category; + } + + public File getFile() { + return file; + } + + public void setFile(File file) { + this.file = file; + } + + public Integer getLine() { + return line; + } + + public void setLine(Integer line) { + this.line = line; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } +} diff --git a/src/main/resources/com/sonar/sqale/clang-model.xml b/src/main/resources/com/sonar/sqale/clang-model.xml new file mode 100644 index 00000000..62db4417 --- /dev/null +++ b/src/main/resources/com/sonar/sqale/clang-model.xml @@ -0,0 +1,172 @@ + + + REUSABILITY + Reusability + + MODULARITY + Modularity + + + TRANSPORTABILITY + Transportability + + + + PORTABILITY + Portability + + COMPILER_RELATED_PORTABILITY + Compiler + + + HARDWARE_RELATED_PORTABILITY + Hardware + + + LANGUAGE_RELATED_PORTABILITY + Language + + + OS_RELATED_PORTABILITY + OS + + + SOFTWARE_RELATED_PORTABILITY + Software + + + TIME_ZONE_RELATED_PORTABILITY + Time zone + + + + MAINTAINABILITY + Maintainability + + READABILITY + Readability + + + UNDERSTANDABILITY + Understandability + + + + SECURITY + Security + + API_ABUSE + API abuse + + + ERRORS + Errors + + + INPUT_VALIDATION_AND_REPRESENTATION + Input validation and representation + + + SECURITY_FEATURES + Security features + + + + EFFICIENCY + Efficiency + + MEMORY_EFFICIENCY + Memory use + + + CPU_EFFICIENCY + Processor use + + + + CHANGEABILITY + Changeability + + ARCHITECTURE_CHANGEABILITY + Architecture + + + DATA_CHANGEABILITY + Data + + + LOGIC_CHANGEABILITY + Logic + + + + RELIABILITY + Reliability + + ARCHITECTURE_RELIABILITY + Architecture + + + DATA_RELIABILITY + Data + + + EXCEPTION_HANDLING + Exception handling + + + FAULT_TOLERANCE + Fault tolerance + + + INSTRUCTION_RELIABILITY + Instruction + + + LOGIC_RELIABILITY + Logic + + clang + other + + remediationFunction + CONSTANT_ISSUE + + + remediationFactor + 0.0 + d + + + offset + 30.0 + mn + + + + + RESOURCE_RELIABILITY + Resource + + + SYNCHRONIZATION_RELIABILITY + Synchronization + + + UNIT_TESTS + Unit tests coverage + + + + TESTABILITY + Testability + + INTEGRATION_TESTABILITY + Integration level + + + UNIT_TESTABILITY + Unit level + + + diff --git a/src/main/resources/org/sonar/plugins/objectivec/rules-clang.xml b/src/main/resources/org/sonar/plugins/objectivec/rules-clang.xml new file mode 100644 index 00000000..180b22a1 --- /dev/null +++ b/src/main/resources/org/sonar/plugins/objectivec/rules-clang.xml @@ -0,0 +1,9 @@ + + + other + other + Clang Static Analyzer warning - other + MAJOR + Warning reported by Clang Static Analyzer (uncategorized). + + From 4c2afda56e81b1bab7c17f144d0c4a4d346dbccc Mon Sep 17 00:00:00 2001 From: Matthew DeTullio Date: Fri, 23 Oct 2015 17:43:13 -0400 Subject: [PATCH 22/42] Refactor to remove deprecation, add keywords --- .../objectivec/api/ObjectiveCKeyword.java | 5 +- .../plugins/objectivec/ObjectiveCPlugin.java | 1 + .../objectivec/ObjectiveCSquidSensor.java | 122 ++++++++++++------ .../objectivec/issues/ClangSensor.java | 8 +- 4 files changed, 88 insertions(+), 48 deletions(-) diff --git a/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java b/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java index df2c1a81..7a2fc61c 100644 --- a/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java +++ b/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java @@ -112,6 +112,7 @@ public enum ObjectiveCKeyword implements TokenType { ELSE("else"), ENUM("enum"), EXTERN("extern"), + FALSE("false"), FLOAT("float"), FOR("for"), GOTO("goto"), @@ -126,6 +127,7 @@ public enum ObjectiveCKeyword implements TokenType { STATIC("static"), STRUCT("struct"), SWITCH("switch"), + TRUE("true"), TYPEDEF("typedef"), UNION("union"), UNSIGNED("unsigned"), @@ -137,6 +139,7 @@ public enum ObjectiveCKeyword implements TokenType { BOOL("BOOL"), SUPER("super"), + SELF("self"), ID("id"), CLASS("Class"), IMP("IMP"), @@ -147,7 +150,7 @@ public enum ObjectiveCKeyword implements TokenType { private final String value; - private ObjectiveCKeyword(String value) { + /*private*/ ObjectiveCKeyword(String value) { this.value = value; } diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java index 4916f9c5..7674eb68 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java @@ -43,6 +43,7 @@ import org.sonar.plugins.objectivec.violations.OCLintSensor; @Properties({ + // TODO add missing clang, lizard @Property(key = CoberturaSensor.REPORT_PATTERN_KEY, defaultValue = CoberturaSensor.DEFAULT_REPORT_PATTERN, name = "Path to unit test coverage report(s)", description = "Relative to projects' root. Ant patterns are accepted", global = false, project = true), @Property(key = OCLintSensor.REPORT_PATH_KEY, defaultValue = OCLintSensor.DEFAULT_REPORT_PATH, name = "Path to oclint pmd formatted report", description = "Relative to projects' root.", global = false, project = true) }) diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java index a901ba9b..96d545e8 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java @@ -19,20 +19,23 @@ */ package org.sonar.plugins.objectivec; -import java.util.Collection; -import java.util.Locale; - +import com.google.common.collect.ImmutableList; +import com.google.common.collect.Lists; import org.sonar.api.batch.Sensor; import org.sonar.api.batch.SensorContext; -import org.sonar.api.checks.AnnotationCheckFactory; +import org.sonar.api.batch.fs.FilePredicate; +import org.sonar.api.batch.fs.FileSystem; +import org.sonar.api.batch.fs.InputFile; +import org.sonar.api.batch.rule.CheckFactory; +import org.sonar.api.batch.rule.Checks; +import org.sonar.api.component.ResourcePerspectives; +import org.sonar.api.issue.Issuable; +import org.sonar.api.issue.Issuable.IssueBuilder; import org.sonar.api.measures.CoreMetrics; -import org.sonar.api.measures.PersistenceMode; -import org.sonar.api.measures.RangeDistributionBuilder; -import org.sonar.api.profiles.RulesProfile; -import org.sonar.api.resources.File; -import org.sonar.api.resources.InputFileUtils; import org.sonar.api.resources.Project; -import org.sonar.api.rules.Violation; +import org.sonar.api.resources.Resource; +import org.sonar.api.rule.RuleKey; +import org.sonar.api.scan.filesystem.PathResolver; import org.sonar.objectivec.ObjectiveCAstScanner; import org.sonar.objectivec.ObjectiveCConfiguration; import org.sonar.objectivec.api.ObjectiveCGrammar; @@ -40,53 +43,69 @@ import org.sonar.objectivec.checks.CheckList; import org.sonar.plugins.objectivec.core.ObjectiveC; import org.sonar.squidbridge.AstScanner; +import org.sonar.squidbridge.SquidAstVisitor; import org.sonar.squidbridge.api.CheckMessage; import org.sonar.squidbridge.api.SourceCode; import org.sonar.squidbridge.api.SourceFile; -import org.sonar.squidbridge.api.SourceFunction; import org.sonar.squidbridge.checks.SquidCheck; -import org.sonar.squidbridge.indexer.QueryByParent; import org.sonar.squidbridge.indexer.QueryByType; -import org.sonar.squidbridge.measures.Metric; - -public class ObjectiveCSquidSensor implements Sensor { +import java.util.Collection; +import java.util.List; +import java.util.Locale; - private final AnnotationCheckFactory annotationCheckFactory; +public class ObjectiveCSquidSensor implements Sensor { private Project project; private SensorContext context; - private AstScanner scanner; - public ObjectiveCSquidSensor(RulesProfile profile) { - this.annotationCheckFactory = AnnotationCheckFactory.create(profile, CheckList.REPOSITORY_KEY, CheckList.getChecks()); + private final Checks> checks; + private final FileSystem fileSystem; + private final FilePredicate mainFilePredicates; + private final PathResolver pathResolver; + private final ResourcePerspectives resourcePerspectives; + + public ObjectiveCSquidSensor(CheckFactory checkFactory, FileSystem fileSystem, ResourcePerspectives resourcePerspectives, PathResolver pathResolver) { + this.checks = checkFactory + .>create(CheckList.REPOSITORY_KEY) + .addAnnotatedChecks(CheckList.getChecks()); + this.fileSystem = fileSystem; + this.mainFilePredicates = fileSystem.predicates().and( + fileSystem.predicates().hasLanguage(ObjectiveC.KEY), + fileSystem.predicates().hasType(InputFile.Type.MAIN)); + this.pathResolver = pathResolver; + this.resourcePerspectives = resourcePerspectives; } public boolean shouldExecuteOnProject(Project project) { - return ObjectiveC.KEY.equals(project.getLanguageKey()); + return project.isRoot() && fileSystem.hasFiles(fileSystem.predicates().hasLanguage(ObjectiveC.KEY)); } public void analyse(Project project, SensorContext context) { this.project = project; this.context = context; - Collection squidChecks = annotationCheckFactory.getChecks(); - this.scanner = ObjectiveCAstScanner.create(createConfiguration(project), squidChecks.toArray(new SquidCheck[squidChecks.size()])); - scanner.scanFiles(InputFileUtils.toFiles(project.getFileSystem().mainFiles(ObjectiveC.KEY))); + List> visitors = Lists.>newArrayList(checks.all()); + + @SuppressWarnings("unchecked") AstScanner scanner = + ObjectiveCAstScanner.create(createConfiguration(), visitors.toArray(new SquidAstVisitor[visitors.size()])); + + scanner.scanFiles(ImmutableList.copyOf(fileSystem.files(mainFilePredicates))); Collection squidSourceFiles = scanner.getIndex().search(new QueryByType(SourceFile.class)); save(squidSourceFiles); } - private ObjectiveCConfiguration createConfiguration(Project project) { - return new ObjectiveCConfiguration(project.getFileSystem().getSourceCharset()); + private ObjectiveCConfiguration createConfiguration() { + return new ObjectiveCConfiguration(fileSystem.encoding()); } private void save(Collection squidSourceFiles) { for (SourceCode squidSourceFile : squidSourceFiles) { SourceFile squidFile = (SourceFile) squidSourceFile; - File sonarFile = File.fromIOFile(new java.io.File(squidFile.getKey()), project); + String relativePath = pathResolver.relativePath(fileSystem.baseDir(), new java.io.File(squidFile.getKey())); + InputFile inputFile = fileSystem.inputFile(fileSystem.predicates().hasRelativePath(relativePath)); /* * Distribution is saved in the Lizard sensor and therefore it is not possible to save the complexity @@ -94,35 +113,52 @@ private void save(Collection squidSourceFiles) { */ //saveFilesComplexityDistribution(sonarFile, squidFile); //saveFunctionsComplexityDistribution(sonarFile, squidFile); - saveMeasures(sonarFile, squidFile); - saveViolations(sonarFile, squidFile); + saveMeasures(inputFile, squidFile); + saveViolations(inputFile, squidFile); } } - private void saveMeasures(File sonarFile, SourceFile squidFile) { - context.saveMeasure(sonarFile, CoreMetrics.FILES, squidFile.getDouble(ObjectiveCMetric.FILES)); - context.saveMeasure(sonarFile, CoreMetrics.LINES, squidFile.getDouble(ObjectiveCMetric.LINES)); - context.saveMeasure(sonarFile, CoreMetrics.NCLOC, squidFile.getDouble(ObjectiveCMetric.LINES_OF_CODE)); - /** + private void saveMeasures(InputFile inputFile, SourceFile squidFile) { + context.saveMeasure(inputFile, CoreMetrics.FILES, squidFile.getDouble(ObjectiveCMetric.FILES)); + context.saveMeasure(inputFile, CoreMetrics.LINES, squidFile.getDouble(ObjectiveCMetric.LINES)); + context.saveMeasure(inputFile, CoreMetrics.NCLOC, squidFile.getDouble(ObjectiveCMetric.LINES_OF_CODE)); + context.saveMeasure(inputFile, CoreMetrics.COMMENT_LINES, squidFile.getDouble(ObjectiveCMetric.COMMENT_LINES)); + /* * Saving the same measure more than once per file throws exception. That is why * CoreMetrics.FUNCTIONS and CoreMetrics.COMPLEXITY are not allowed to be saved here. In order for the * LizardSensor to be able to to its job and save the values for those metrics the functionality has been * moved to Lizard classes. */ - //context.saveMeasure(sonarFile, CoreMetrics.FUNCTIONS, squidFile.getDouble(ObjectiveCMetric.FUNCTIONS)); - context.saveMeasure(sonarFile, CoreMetrics.STATEMENTS, squidFile.getDouble(ObjectiveCMetric.STATEMENTS)); - //context.saveMeasure(sonarFile, CoreMetrics.COMPLEXITY, squidFile.getDouble(ObjectiveCMetric.COMPLEXITY)); - context.saveMeasure(sonarFile, CoreMetrics.COMMENT_LINES, squidFile.getDouble(ObjectiveCMetric.COMMENT_LINES)); + //context.saveMeasure(inputFile, CoreMetrics.FUNCTIONS, squidFile.getDouble(ObjectiveCMetric.FUNCTIONS)); + context.saveMeasure(inputFile, CoreMetrics.STATEMENTS, squidFile.getDouble(ObjectiveCMetric.STATEMENTS)); + //context.saveMeasure(inputFile, CoreMetrics.COMPLEXITY, squidFile.getDouble(ObjectiveCMetric.COMPLEXITY)); } - private void saveViolations(File sonarFile, SourceFile squidFile) { + private void saveViolations(InputFile inputFile, SourceFile squidFile) { Collection messages = squidFile.getCheckMessages(); - if (messages != null) { + + Resource resource = context.getResource( + org.sonar.api.resources.File.fromIOFile(inputFile.file(), project)); + + if (messages != null && resource != null) { for (CheckMessage message : messages) { - Violation violation = Violation.create(annotationCheckFactory.getActiveRule(message.getChecker()), sonarFile) - .setLineId(message.getLine()) - .setMessage(message.getText(Locale.ENGLISH)); - context.saveViolation(violation); + @SuppressWarnings("unchecked") RuleKey ruleKey = + checks.ruleKey((SquidCheck) message.getCheck()); + + Issuable issuable = resourcePerspectives.as(Issuable.class, resource); + + if (issuable != null) { + IssueBuilder issueBuilder = issuable.newIssueBuilder() + .ruleKey(ruleKey) + .line(message.getLine()) + .message(message.getText(Locale.ENGLISH)); + + if (message.getCost() != null) { + issueBuilder.effortToFix(message.getCost()); + } + + issuable.addIssue(issueBuilder.build()); + } } } } diff --git a/src/main/java/org/sonar/plugins/objectivec/issues/ClangSensor.java b/src/main/java/org/sonar/plugins/objectivec/issues/ClangSensor.java index e0ac5e5b..d8d6c77f 100644 --- a/src/main/java/org/sonar/plugins/objectivec/issues/ClangSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/issues/ClangSensor.java @@ -46,10 +46,10 @@ public class ClangSensor implements Sensor { private static final String REPORT_PATH_KEY = ObjectiveCPlugin.PROPERTY_PREFIX + ".clang.reportsPath"; - private FileSystem fileSystem; - private ResourcePerspectives resourcePerspectives; - private RulesProfile rulesProfile; - private Settings settings; + private final FileSystem fileSystem; + private final ResourcePerspectives resourcePerspectives; + private final RulesProfile rulesProfile; + private final Settings settings; public ClangSensor(FileSystem fileSystem, ResourcePerspectives resourcePerspectives, RulesProfile rulesProfile, Settings settings) { this.fileSystem = fileSystem; From f9f6fa5fe60f581d4b321730318ac35952028a0b Mon Sep 17 00:00:00 2001 From: Matthew DeTullio Date: Fri, 23 Oct 2015 18:45:40 -0400 Subject: [PATCH 23/42] Package info --- .../sonar/objectivec/api/package-info.java | 23 +++++++++++++++++++ .../sonar/objectivec/checks/package-info.java | 23 +++++++++++++++++++ .../sonar/objectivec/lexer/package-info.java | 23 +++++++++++++++++++ .../org/sonar/objectivec/package-info.java | 23 +++++++++++++++++++ .../sonar/objectivec/parser/package-info.java | 23 +++++++++++++++++++ .../objectivec/colorizer/package-info.java | 23 +++++++++++++++++++ .../objectivec/complexity/package-info.java | 23 +++++++++++++++++++ .../plugins/objectivec/core/package-info.java | 23 +++++++++++++++++++ .../objectivec/coverage/package-info.java | 23 +++++++++++++++++++ .../plugins/objectivec/cpd/package-info.java | 23 +++++++++++++++++++ .../objectivec/issues/package-info.java | 23 +++++++++++++++++++ .../plugins/objectivec/package-info.java | 23 +++++++++++++++++++ .../objectivec/tests/package-info.java | 23 +++++++++++++++++++ .../objectivec/violations/package-info.java | 23 +++++++++++++++++++ 14 files changed, 322 insertions(+) create mode 100644 src/main/java/org/sonar/objectivec/api/package-info.java create mode 100644 src/main/java/org/sonar/objectivec/checks/package-info.java create mode 100644 src/main/java/org/sonar/objectivec/lexer/package-info.java create mode 100644 src/main/java/org/sonar/objectivec/package-info.java create mode 100644 src/main/java/org/sonar/objectivec/parser/package-info.java create mode 100644 src/main/java/org/sonar/plugins/objectivec/colorizer/package-info.java create mode 100644 src/main/java/org/sonar/plugins/objectivec/complexity/package-info.java create mode 100644 src/main/java/org/sonar/plugins/objectivec/core/package-info.java create mode 100644 src/main/java/org/sonar/plugins/objectivec/coverage/package-info.java create mode 100644 src/main/java/org/sonar/plugins/objectivec/cpd/package-info.java create mode 100644 src/main/java/org/sonar/plugins/objectivec/issues/package-info.java create mode 100644 src/main/java/org/sonar/plugins/objectivec/package-info.java create mode 100644 src/main/java/org/sonar/plugins/objectivec/tests/package-info.java create mode 100644 src/main/java/org/sonar/plugins/objectivec/violations/package-info.java diff --git a/src/main/java/org/sonar/objectivec/api/package-info.java b/src/main/java/org/sonar/objectivec/api/package-info.java new file mode 100644 index 00000000..be24db27 --- /dev/null +++ b/src/main/java/org/sonar/objectivec/api/package-info.java @@ -0,0 +1,23 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +@ParametersAreNonnullByDefault +package org.sonar.objectivec.api; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/org/sonar/objectivec/checks/package-info.java b/src/main/java/org/sonar/objectivec/checks/package-info.java new file mode 100644 index 00000000..13ef4c7c --- /dev/null +++ b/src/main/java/org/sonar/objectivec/checks/package-info.java @@ -0,0 +1,23 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +@ParametersAreNonnullByDefault +package org.sonar.objectivec.checks; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/org/sonar/objectivec/lexer/package-info.java b/src/main/java/org/sonar/objectivec/lexer/package-info.java new file mode 100644 index 00000000..70d2f736 --- /dev/null +++ b/src/main/java/org/sonar/objectivec/lexer/package-info.java @@ -0,0 +1,23 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +@ParametersAreNonnullByDefault +package org.sonar.objectivec.lexer; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/org/sonar/objectivec/package-info.java b/src/main/java/org/sonar/objectivec/package-info.java new file mode 100644 index 00000000..7be86d2a --- /dev/null +++ b/src/main/java/org/sonar/objectivec/package-info.java @@ -0,0 +1,23 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +@ParametersAreNonnullByDefault +package org.sonar.objectivec; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/org/sonar/objectivec/parser/package-info.java b/src/main/java/org/sonar/objectivec/parser/package-info.java new file mode 100644 index 00000000..9537787a --- /dev/null +++ b/src/main/java/org/sonar/objectivec/parser/package-info.java @@ -0,0 +1,23 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +@ParametersAreNonnullByDefault +package org.sonar.objectivec.parser; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/org/sonar/plugins/objectivec/colorizer/package-info.java b/src/main/java/org/sonar/plugins/objectivec/colorizer/package-info.java new file mode 100644 index 00000000..dcc7b700 --- /dev/null +++ b/src/main/java/org/sonar/plugins/objectivec/colorizer/package-info.java @@ -0,0 +1,23 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +@ParametersAreNonnullByDefault +package org.sonar.plugins.objectivec.colorizer; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/package-info.java b/src/main/java/org/sonar/plugins/objectivec/complexity/package-info.java new file mode 100644 index 00000000..8a43ca20 --- /dev/null +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/package-info.java @@ -0,0 +1,23 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +@ParametersAreNonnullByDefault +package org.sonar.plugins.objectivec.complexity; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/org/sonar/plugins/objectivec/core/package-info.java b/src/main/java/org/sonar/plugins/objectivec/core/package-info.java new file mode 100644 index 00000000..960327d6 --- /dev/null +++ b/src/main/java/org/sonar/plugins/objectivec/core/package-info.java @@ -0,0 +1,23 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +@ParametersAreNonnullByDefault +package org.sonar.plugins.objectivec.core; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/org/sonar/plugins/objectivec/coverage/package-info.java b/src/main/java/org/sonar/plugins/objectivec/coverage/package-info.java new file mode 100644 index 00000000..684e31d5 --- /dev/null +++ b/src/main/java/org/sonar/plugins/objectivec/coverage/package-info.java @@ -0,0 +1,23 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +@ParametersAreNonnullByDefault +package org.sonar.plugins.objectivec.coverage; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/org/sonar/plugins/objectivec/cpd/package-info.java b/src/main/java/org/sonar/plugins/objectivec/cpd/package-info.java new file mode 100644 index 00000000..483b08c5 --- /dev/null +++ b/src/main/java/org/sonar/plugins/objectivec/cpd/package-info.java @@ -0,0 +1,23 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +@ParametersAreNonnullByDefault +package org.sonar.plugins.objectivec.cpd; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/org/sonar/plugins/objectivec/issues/package-info.java b/src/main/java/org/sonar/plugins/objectivec/issues/package-info.java new file mode 100644 index 00000000..cfd54956 --- /dev/null +++ b/src/main/java/org/sonar/plugins/objectivec/issues/package-info.java @@ -0,0 +1,23 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +@ParametersAreNonnullByDefault +package org.sonar.plugins.objectivec.issues; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/org/sonar/plugins/objectivec/package-info.java b/src/main/java/org/sonar/plugins/objectivec/package-info.java new file mode 100644 index 00000000..6c5a8e45 --- /dev/null +++ b/src/main/java/org/sonar/plugins/objectivec/package-info.java @@ -0,0 +1,23 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +@ParametersAreNonnullByDefault +package org.sonar.plugins.objectivec; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/org/sonar/plugins/objectivec/tests/package-info.java b/src/main/java/org/sonar/plugins/objectivec/tests/package-info.java new file mode 100644 index 00000000..b3b59e85 --- /dev/null +++ b/src/main/java/org/sonar/plugins/objectivec/tests/package-info.java @@ -0,0 +1,23 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +@ParametersAreNonnullByDefault +package org.sonar.plugins.objectivec.tests; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/org/sonar/plugins/objectivec/violations/package-info.java b/src/main/java/org/sonar/plugins/objectivec/violations/package-info.java new file mode 100644 index 00000000..67b7e11b --- /dev/null +++ b/src/main/java/org/sonar/plugins/objectivec/violations/package-info.java @@ -0,0 +1,23 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +@ParametersAreNonnullByDefault +package org.sonar.plugins.objectivec.violations; + +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file From b84c285ee2144e1f084f69f3dcd609002fb81c20 Mon Sep 17 00:00:00 2001 From: Matthew DeTullio Date: Mon, 2 Nov 2015 19:38:27 -0500 Subject: [PATCH 24/42] Heavy refactoring: Remove nearly all deprecated API usage (still need to do ObjectiveCGrammarImpl). Update Cobertura and Surefire to be closer to latest implementations in the sonar-java and sonar-cobertura plugins. Update OCLint to use XML-based rules configuration. Bring entire code base more inline with other plugins. Make analysis properties more consistent and add extensions for them. --- pom.xml | 64 +-- .../objectivec/ObjectiveCAstScanner.java | 26 +- .../objectivec/ObjectiveCConfiguration.java | 4 +- .../objectivec/api/ObjectiveCMetric.java | 1 - .../sonar/objectivec/checks/CheckList.java | 10 +- .../objectivec/lexer/ObjectiveCLexer.java | 13 +- .../parser/ObjectiveCGrammarImpl.java | 8 +- .../objectivec/parser/ObjectiveCParser.java | 13 +- .../objectivec/{core => }/ObjectiveC.java | 48 +- .../plugins/objectivec/ObjectiveCPlugin.java | 124 +++-- .../plugins/objectivec/ObjectiveCProfile.java | 1 - .../objectivec/ObjectiveCSquidSensor.java | 12 +- .../colorizer/ObjectiveCColorizerFormat.java | 7 +- .../complexity/LizardMeasurePersistor.java | 82 --- .../complexity/LizardReportParser.java | 81 +-- .../objectivec/complexity/LizardSensor.java | 102 ++-- .../core/ObjectiveCSourceImporter.java | 41 -- .../plugins/objectivec/core/package-info.java | 23 - .../objectivec/coverage/CoberturaParser.java | 69 --- .../coverage/CoberturaReportParser.java | 128 +++++ .../objectivec/coverage/CoberturaSensor.java | 68 +-- .../objectivec/coverage/CoberturaSensor.old | 74 --- .../coverage/CoberturaXMLStreamHandler.java | 100 ---- .../coverage/CoverageMeasuresPersistor.java | 77 --- .../coverage/ReportFilesFinder.java | 70 --- .../objectivec/cpd/ObjectiveCCpdMapping.java | 15 +- .../objectivec/cpd/ObjectiveCTokenizer.java | 14 +- .../objectivec/issues/ClangPlistParser.java | 6 +- .../issues/ClangRulesDefinition.java | 2 +- .../objectivec/issues/ClangSensor.java | 31 +- .../objectivec/tests/SurefireParser.java | 109 ++-- .../objectivec/tests/SurefireSensor.java | 74 +-- .../objectivec/violations/OCLintParser.java | 105 ++-- .../objectivec/violations/OCLintProfile.java | 32 +- .../violations/OCLintProfileImporter.java | 15 +- .../violations/OCLintRuleParser.java | 113 ---- .../violations/OCLintRuleRepository.java | 62 --- .../violations/OCLintRulesDefinition.java | 47 ++ .../objectivec/violations/OCLintSensor.java | 70 +-- .../violations/OCLintXMLStreamHandler.java | 110 ---- ...{objectivec-model.xml => oclint-model.xml} | 0 .../plugins/objectivec/profile-oclint.xml | 258 +++++++++ .../sonar/plugins/objectivec/rules-clang.xml | 1 - .../sonar/plugins/objectivec/rules-oclint.xml | 380 +++++++++++++ .../sonar/plugins/oclint/profile-oclint.xml | 259 --------- .../org/sonar/plugins/oclint/rules.txt | 509 ------------------ .../complexity/LizardReportParserTest.java | 8 +- .../complexity/LizardSensorTest.java | 85 --- .../CoberturaMeasuresPersistorTest.java | 95 ---- .../coverage/CoberturaParserTest.java | 60 --- .../coverage/CoberturaSensorTest.java | 76 --- .../CoberturaXMLStreamHandlerTest.java | 114 ---- .../violations/OCLintParserTest.java | 81 --- .../violations/OCLintSensorTest.java | 74 --- .../OCLintXMLStreamHandlerTest.java | 94 ---- updateRules.groovy | 223 +++----- 56 files changed, 1437 insertions(+), 2931 deletions(-) rename src/main/java/org/sonar/plugins/objectivec/{core => }/ObjectiveC.java (65%) delete mode 100644 src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java delete mode 100644 src/main/java/org/sonar/plugins/objectivec/core/ObjectiveCSourceImporter.java delete mode 100644 src/main/java/org/sonar/plugins/objectivec/core/package-info.java delete mode 100644 src/main/java/org/sonar/plugins/objectivec/coverage/CoberturaParser.java create mode 100644 src/main/java/org/sonar/plugins/objectivec/coverage/CoberturaReportParser.java delete mode 100644 src/main/java/org/sonar/plugins/objectivec/coverage/CoberturaSensor.old delete mode 100644 src/main/java/org/sonar/plugins/objectivec/coverage/CoberturaXMLStreamHandler.java delete mode 100644 src/main/java/org/sonar/plugins/objectivec/coverage/CoverageMeasuresPersistor.java delete mode 100644 src/main/java/org/sonar/plugins/objectivec/coverage/ReportFilesFinder.java delete mode 100644 src/main/java/org/sonar/plugins/objectivec/violations/OCLintRuleParser.java delete mode 100644 src/main/java/org/sonar/plugins/objectivec/violations/OCLintRuleRepository.java create mode 100644 src/main/java/org/sonar/plugins/objectivec/violations/OCLintRulesDefinition.java delete mode 100644 src/main/java/org/sonar/plugins/objectivec/violations/OCLintXMLStreamHandler.java rename src/main/resources/com/sonar/sqale/{objectivec-model.xml => oclint-model.xml} (100%) create mode 100644 src/main/resources/org/sonar/plugins/objectivec/profile-oclint.xml create mode 100644 src/main/resources/org/sonar/plugins/objectivec/rules-oclint.xml delete mode 100644 src/main/resources/org/sonar/plugins/oclint/profile-oclint.xml delete mode 100644 src/main/resources/org/sonar/plugins/oclint/rules.txt delete mode 100644 src/test/java/org/sonar/plugins/objectivec/complexity/LizardSensorTest.java delete mode 100644 src/test/java/org/sonar/plugins/objectivec/coverage/CoberturaMeasuresPersistorTest.java delete mode 100644 src/test/java/org/sonar/plugins/objectivec/coverage/CoberturaParserTest.java delete mode 100644 src/test/java/org/sonar/plugins/objectivec/coverage/CoberturaSensorTest.java delete mode 100644 src/test/java/org/sonar/plugins/objectivec/coverage/CoberturaXMLStreamHandlerTest.java delete mode 100644 src/test/java/org/sonar/plugins/objectivec/violations/OCLintParserTest.java delete mode 100644 src/test/java/org/sonar/plugins/objectivec/violations/OCLintSensorTest.java delete mode 100644 src/test/java/org/sonar/plugins/objectivec/violations/OCLintXMLStreamHandlerTest.java diff --git a/pom.xml b/pom.xml index 2138e115..dfd19d15 100644 --- a/pom.xml +++ b/pom.xml @@ -110,17 +110,6 @@ sonar-plugin-api ${sonar.version} - - org.codehaus.sonar - sonar-testing-harness - ${sonar.version} - - - org.codehaus.sonar - sonar-deprecated - ${sonar.version} - - org.codehaus.sonar.sslr sslr-core @@ -136,62 +125,63 @@ sslr-toolkit ${sslr.version} - - org.codehaus.sonar.sslr - sslr-testing-harness - ${sslr.version} - org.codehaus.sonar.sslr-squid-bridge sslr-squid-bridge 2.5.3 - ant - ant - 1.6 + org.codehaus.sonar.plugins + sonar-surefire-plugin + 2.7 + + + com.googlecode.plist + dd-plist + 1.16 + + + + org.codehaus.sonar + sonar-testing-harness + ${sonar.version} + test + + + org.codehaus.sonar.sslr + sslr-testing-harness + ${sslr.version} + test - junit junit 4.10 + test org.mockito mockito-all 1.9.0 + test org.hamcrest hamcrest-all 1.1 + test org.easytesting fest-assert 1.4 + test ch.qos.logback logback-classic - 0.9.30 - - - org.codehaus.sonar.plugins - sonar-surefire-plugin - 2.7 - - - xml-apis - xml-apis - 1.0.b2 - - - - com.googlecode.plist - dd-plist - 1.16 + 1.1.3 + test diff --git a/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java b/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java index ae3b590e..7ea0df94 100644 --- a/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java +++ b/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java @@ -19,9 +19,7 @@ */ package org.sonar.objectivec; -import java.io.File; -import java.util.Collection; - +import com.sonar.sslr.impl.Parser; import org.sonar.objectivec.api.ObjectiveCGrammar; import org.sonar.objectivec.api.ObjectiveCMetric; import org.sonar.objectivec.parser.ObjectiveCParser; @@ -37,7 +35,8 @@ import org.sonar.squidbridge.metrics.LinesOfCodeVisitor; import org.sonar.squidbridge.metrics.LinesVisitor; -import com.sonar.sslr.impl.Parser; +import java.io.File; +import java.util.Collection; public class ObjectiveCAstScanner { @@ -60,11 +59,12 @@ public static SourceFile scanSingleFile(File file, SquidAstVisitor create(ObjectiveCConfiguration conf, SquidAstVisitor... visitors) { + public static AstScanner create(ObjectiveCConfiguration conf, + SquidAstVisitor... visitors) { final SquidAstVisitorContextImpl context = new SquidAstVisitorContextImpl(new SourceProject("Objective-C Project")); final Parser parser = ObjectiveCParser.create(conf); - AstScanner.Builder builder = AstScanner. builder(context).setBaseParser(parser); + AstScanner.Builder builder = AstScanner.builder(context).setBaseParser(parser); /* Metrics */ builder.withMetrics(ObjectiveCMetric.values()); @@ -89,15 +89,15 @@ public String getContents(String comment) { }); /* Files */ - builder.setFilesMetric(ObjectiveCMetric.FILES); + builder.setFilesMetric(ObjectiveCMetric.FILES); /* Metrics */ - builder.withSquidAstVisitor(new LinesVisitor(ObjectiveCMetric.LINES)); - builder.withSquidAstVisitor(new LinesOfCodeVisitor(ObjectiveCMetric.LINES_OF_CODE)); - builder.withSquidAstVisitor(CommentsVisitor. builder().withCommentMetric(ObjectiveCMetric.COMMENT_LINES) - .withNoSonar(true) - .withIgnoreHeaderComment(conf.getIgnoreHeaderComments()) - .build()); + builder.withSquidAstVisitor(new LinesVisitor(ObjectiveCMetric.LINES)); + builder.withSquidAstVisitor(new LinesOfCodeVisitor(ObjectiveCMetric.LINES_OF_CODE)); + builder.withSquidAstVisitor(CommentsVisitor.builder().withCommentMetric(ObjectiveCMetric.COMMENT_LINES) + .withNoSonar(true) + .withIgnoreHeaderComment(conf.getIgnoreHeaderComments()) + .build()); return builder.build(); } diff --git a/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java b/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java index cee56859..068ee412 100644 --- a/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java +++ b/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java @@ -19,10 +19,10 @@ */ package org.sonar.objectivec; -import java.nio.charset.Charset; - import org.sonar.squid.api.SquidConfiguration; +import java.nio.charset.Charset; + public class ObjectiveCConfiguration extends SquidConfiguration { private boolean ignoreHeaderComments; diff --git a/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java b/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java index 23058102..ba050d74 100644 --- a/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java +++ b/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java @@ -27,7 +27,6 @@ public enum ObjectiveCMetric implements MetricDef { LINES, LINES_OF_CODE, COMMENT_LINES, - STATEMENTS, COMPLEXITY, FUNCTIONS; diff --git a/src/main/java/org/sonar/objectivec/checks/CheckList.java b/src/main/java/org/sonar/objectivec/checks/CheckList.java index be5d018f..7de2b77c 100644 --- a/src/main/java/org/sonar/objectivec/checks/CheckList.java +++ b/src/main/java/org/sonar/objectivec/checks/CheckList.java @@ -19,10 +19,10 @@ */ package org.sonar.objectivec.checks; -import java.util.List; - import com.google.common.collect.ImmutableList; +import java.util.List; + public final class CheckList { public static final String REPOSITORY_KEY = "objectivec"; @@ -33,9 +33,9 @@ private CheckList() { } public static List getChecks() { - return ImmutableList. of( - - ); + return ImmutableList.of( + // Add checks here + ); } } diff --git a/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java b/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java index c0f72700..4f65847d 100644 --- a/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java +++ b/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java @@ -19,15 +19,14 @@ */ package org.sonar.objectivec.lexer; +import com.sonar.sslr.impl.Lexer; +import com.sonar.sslr.impl.channel.BlackHoleChannel; +import org.sonar.objectivec.ObjectiveCConfiguration; + import static com.sonar.sslr.api.GenericTokenType.LITERAL; import static com.sonar.sslr.impl.channel.RegexpChannelBuilder.commentRegexp; import static com.sonar.sslr.impl.channel.RegexpChannelBuilder.regexp; -import org.sonar.objectivec.ObjectiveCConfiguration; - -import com.sonar.sslr.impl.Lexer; -import com.sonar.sslr.impl.channel.BlackHoleChannel; - public class ObjectiveCLexer { private ObjectiveCLexer() { @@ -43,11 +42,11 @@ public static Lexer create(ObjectiveCConfiguration conf) { .withFailIfNoChannelToConsumeOneCharacter(false) - // Comments + // Comments .withChannel(commentRegexp("//[^\\n\\r]*+")) .withChannel(commentRegexp("/\\*[\\s\\S]*?\\*/")) - // All other tokens + // All other tokens .withChannel(regexp(LITERAL, "[^\r\n\\s/]+")) .withChannel(new BlackHoleChannel("[\\s]")) diff --git a/src/main/java/org/sonar/objectivec/parser/ObjectiveCGrammarImpl.java b/src/main/java/org/sonar/objectivec/parser/ObjectiveCGrammarImpl.java index 14bb779f..de51d7f5 100644 --- a/src/main/java/org/sonar/objectivec/parser/ObjectiveCGrammarImpl.java +++ b/src/main/java/org/sonar/objectivec/parser/ObjectiveCGrammarImpl.java @@ -19,18 +19,16 @@ */ package org.sonar.objectivec.parser; +import org.sonar.objectivec.api.ObjectiveCGrammar; + import static com.sonar.sslr.api.GenericTokenType.EOF; import static com.sonar.sslr.api.GenericTokenType.LITERAL; import static com.sonar.sslr.impl.matcher.GrammarFunctions.Standard.o2n; -import org.sonar.objectivec.api.ObjectiveCGrammar; - public class ObjectiveCGrammarImpl extends ObjectiveCGrammar { public ObjectiveCGrammarImpl() { - - program.is(o2n(LITERAL), EOF); - + program.is(o2n(LITERAL), EOF); } } diff --git a/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java b/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java index 6f0d2c19..6a52ce28 100644 --- a/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java +++ b/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java @@ -19,26 +19,25 @@ */ package org.sonar.objectivec.parser; +import com.sonar.sslr.impl.Parser; import org.sonar.objectivec.ObjectiveCConfiguration; import org.sonar.objectivec.api.ObjectiveCGrammar; import org.sonar.objectivec.lexer.ObjectiveCLexer; -import com.sonar.sslr.impl.Parser; -import com.sonar.sslr.impl.events.ParsingEventListener; - public class ObjectiveCParser { private ObjectiveCParser() { + // Prevent outside instantiation } - public static Parser create(ParsingEventListener... parsingEventListeners) { - return create(new ObjectiveCConfiguration(), parsingEventListeners); + public static Parser create() { + return create(new ObjectiveCConfiguration()); } - public static Parser create(ObjectiveCConfiguration conf, ParsingEventListener... parsingEventListeners) { + public static Parser create(ObjectiveCConfiguration conf) { return Parser.builder((ObjectiveCGrammar) new ObjectiveCGrammarImpl()) .withLexer(ObjectiveCLexer.create(conf)) - .setParsingEventListeners(parsingEventListeners).build(); + .build(); } } diff --git a/src/main/java/org/sonar/plugins/objectivec/core/ObjectiveC.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java similarity index 65% rename from src/main/java/org/sonar/plugins/objectivec/core/ObjectiveC.java rename to src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java index 25e3904d..7d2d6034 100644 --- a/src/main/java/org/sonar/plugins/objectivec/core/ObjectiveC.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java @@ -17,33 +17,53 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.objectivec.core; - -import java.util.List; +package org.sonar.plugins.objectivec; +import com.google.common.collect.Lists; import org.apache.commons.lang.StringUtils; import org.sonar.api.config.Settings; import org.sonar.api.resources.AbstractLanguage; -import org.sonar.plugins.objectivec.ObjectiveCPlugin; -import com.google.common.collect.Lists; +import java.util.List; public class ObjectiveC extends AbstractLanguage { + /** + * Objective-C key + */ public static final String KEY = "objc"; + /** + * Objective-C name + */ + public static final String NAME = "Objective-C"; + + /** + * Key of the file suffix parameter + */ + public static final String FILE_SUFFIXES_KEY = "sonar.objectivec.file.suffixes"; + + /** + * Default Java files knows suffixes + */ + public static final String DEFAULT_FILE_SUFFIXES = ".h,.m"; + private Settings settings; + /** + * Default constructor + * + * @param settings Injected project batch and global server settings + */ public ObjectiveC(Settings settings) { - - super(KEY, "Objective-C"); + super(KEY, NAME); this.settings = settings; } public String[] getFileSuffixes() { - String[] suffixes = filterEmptyStrings(settings.getStringArray(ObjectiveCPlugin.FILE_SUFFIXES_KEY)); - if (suffixes == null || suffixes.length == 0) { - suffixes = StringUtils.split(ObjectiveCPlugin.FILE_SUFFIXES_DEFVALUE, ","); + String[] suffixes = filterEmptyStrings(settings.getStringArray(ObjectiveC.FILE_SUFFIXES_KEY)); + if (suffixes.length == 0) { + suffixes = StringUtils.split(ObjectiveC.DEFAULT_FILE_SUFFIXES, ","); } return suffixes; } @@ -51,10 +71,10 @@ public String[] getFileSuffixes() { private String[] filterEmptyStrings(String[] stringArray) { List nonEmptyStrings = Lists.newArrayList(); for (String string : stringArray) { - if (StringUtils.isNotBlank(string.trim())) { - nonEmptyStrings.add(string.trim()); - } + if (StringUtils.isNotBlank(string.trim())) { + nonEmptyStrings.add(string.trim()); + } } return nonEmptyStrings.toArray(new String[nonEmptyStrings.size()]); - } + } } diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java index 7674eb68..b3b0a311 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java @@ -19,71 +19,89 @@ */ package org.sonar.plugins.objectivec; -import java.util.List; - -import org.sonar.api.Extension; -import org.sonar.api.Properties; -import org.sonar.api.Property; import org.sonar.api.SonarPlugin; +import org.sonar.api.config.PropertyDefinition; +import org.sonar.api.resources.Qualifiers; +import org.sonar.plugins.objectivec.colorizer.ObjectiveCColorizerFormat; import org.sonar.plugins.objectivec.complexity.LizardSensor; import org.sonar.plugins.objectivec.coverage.CoberturaSensor; -import org.sonar.plugins.objectivec.colorizer.ObjectiveCColorizerFormat; -import org.sonar.plugins.objectivec.core.ObjectiveC; -import org.sonar.plugins.objectivec.core.ObjectiveCSourceImporter; import org.sonar.plugins.objectivec.cpd.ObjectiveCCpdMapping; - -import com.google.common.collect.ImmutableList; - import org.sonar.plugins.objectivec.issues.ClangRulesDefinition; import org.sonar.plugins.objectivec.issues.ClangSensor; import org.sonar.plugins.objectivec.tests.SurefireSensor; import org.sonar.plugins.objectivec.violations.OCLintProfile; import org.sonar.plugins.objectivec.violations.OCLintProfileImporter; -import org.sonar.plugins.objectivec.violations.OCLintRuleRepository; +import org.sonar.plugins.objectivec.violations.OCLintRulesDefinition; import org.sonar.plugins.objectivec.violations.OCLintSensor; -@Properties({ - // TODO add missing clang, lizard - @Property(key = CoberturaSensor.REPORT_PATTERN_KEY, defaultValue = CoberturaSensor.DEFAULT_REPORT_PATTERN, name = "Path to unit test coverage report(s)", description = "Relative to projects' root. Ant patterns are accepted", global = false, project = true), - @Property(key = OCLintSensor.REPORT_PATH_KEY, defaultValue = OCLintSensor.DEFAULT_REPORT_PATH, name = "Path to oclint pmd formatted report", description = "Relative to projects' root.", global = false, project = true) -}) -public class ObjectiveCPlugin extends SonarPlugin { - - public List> getExtensions() { - return ImmutableList.of(ObjectiveC.class, - ObjectiveCSourceImporter.class, - ObjectiveCColorizerFormat.class, - ObjectiveCCpdMapping.class, - - ObjectiveCSquidSensor.class, - ObjectiveCProfile.class, - - SurefireSensor.class, - - CoberturaSensor.class, - - ClangRulesDefinition.class, - ClangSensor.class, - - OCLintRuleRepository.class, - OCLintSensor.class, - OCLintProfile.class, - OCLintProfileImporter.class, +import java.util.ArrayList; +import java.util.List; - LizardSensor.class - ); +public class ObjectiveCPlugin extends SonarPlugin { + public List getExtensions() { + List extensions = new ArrayList(); + + extensions.add(ObjectiveC.class); + extensions.add(PropertyDefinition.builder(ObjectiveC.FILE_SUFFIXES_KEY) + .defaultValue(ObjectiveC.DEFAULT_FILE_SUFFIXES) + .name("File suffixes") + .description("Comma-separated list of suffixes for files to analyze. To not filter, leave the list empty.") + .onQualifiers(Qualifiers.PROJECT) + .build()); + + extensions.add(ObjectiveCColorizerFormat.class); + extensions.add(ObjectiveCCpdMapping.class); + + extensions.add(ObjectiveCSquidSensor.class); + extensions.add(ObjectiveCProfile.class); + + extensions.add(ClangRulesDefinition.class); + extensions.add(ClangSensor.class); + extensions.add(PropertyDefinition.builder(ClangSensor.REPORTS_PATH_KEY) + .name("Clang Static Analyzer Reports") + .description("Path to the directory containing all the *.plist Clang report files. The path may be absolute or relative to the project base directory.") + .subCategory("Clang") + .onQualifiers(Qualifiers.PROJECT) + .build()); + + extensions.add(CoberturaSensor.class); + extensions.add(PropertyDefinition.builder(CoberturaSensor.REPORT_PATH_KEY) + .name("Report path") + .description("Path (absolute or relative) to Cobertura XML report file.") + .subCategory("Cobertura") + .onQualifiers(Qualifiers.PROJECT) + .build()); + + extensions.add(LizardSensor.class); + extensions.add(PropertyDefinition.builder(LizardSensor.REPORT_PATH_KEY) + .name("Report path") + .description("Path (absolute or relative) to Lizard XML report file.") + .subCategory("Complexity") + .onQualifiers(Qualifiers.PROJECT) + .build()); + + extensions.add(OCLintRulesDefinition.class); + extensions.add(OCLintSensor.class); + extensions.add(OCLintProfile.class); + extensions.add(OCLintProfileImporter.class); + extensions.add(PropertyDefinition.builder(OCLintSensor.REPORT_PATH_KEY) + .name("Report path") + .description("Path (absolute or relative) to OCLint PMD formatted XML report file.") + .subCategory("OCLint") + .onQualifiers(Qualifiers.PROJECT) + .build()); + + extensions.add(SurefireSensor.class); + extensions.add(PropertyDefinition.builder(SurefireSensor.REPORTS_PATH_KEY) + .name("JUnit Reports") + .description("Path to the directory containing all the *.xml JUnit report files. The path may be absolute or relative to the project base directory.

" + + "Extra logic has been added to search your test sources for each classname that is defined in the JUnit report.

" + + "Classes will attempt to match the pattern: **/${classname}.m") + .subCategory("JUnit") + .onQualifiers(Qualifiers.PROJECT) + .build()); + + return extensions; } - // Global Objective C constants - public static final String FALSE = "false"; - - public static final String FILE_SUFFIXES_KEY = "sonar.objectivec.file.suffixes"; - public static final String FILE_SUFFIXES_DEFVALUE = "h,m"; - - public static final String PROPERTY_PREFIX = "sonar.objectivec"; - - public static final String TEST_FRAMEWORK_KEY = PROPERTY_PREFIX - + ".testframework"; - public static final String TEST_FRAMEWORK_DEFAULT = "ghunit"; - } diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCProfile.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCProfile.java index e223a48c..000d1ddb 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCProfile.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCProfile.java @@ -24,7 +24,6 @@ import org.sonar.api.profiles.RulesProfile; import org.sonar.api.utils.ValidationMessages; import org.sonar.objectivec.checks.CheckList; -import org.sonar.plugins.objectivec.core.ObjectiveC; public class ObjectiveCProfile extends ProfileDefinition { diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java index 96d545e8..715abb61 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java @@ -41,7 +41,6 @@ import org.sonar.objectivec.api.ObjectiveCGrammar; import org.sonar.objectivec.api.ObjectiveCMetric; import org.sonar.objectivec.checks.CheckList; -import org.sonar.plugins.objectivec.core.ObjectiveC; import org.sonar.squidbridge.AstScanner; import org.sonar.squidbridge.SquidAstVisitor; import org.sonar.squidbridge.api.CheckMessage; @@ -65,7 +64,8 @@ public class ObjectiveCSquidSensor implements Sensor { private final PathResolver pathResolver; private final ResourcePerspectives resourcePerspectives; - public ObjectiveCSquidSensor(CheckFactory checkFactory, FileSystem fileSystem, ResourcePerspectives resourcePerspectives, PathResolver pathResolver) { + public ObjectiveCSquidSensor(CheckFactory checkFactory, FileSystem fileSystem, + ResourcePerspectives resourcePerspectives, PathResolver pathResolver) { this.checks = checkFactory .>create(CheckList.REPOSITORY_KEY) .addAnnotatedChecks(CheckList.getChecks()); @@ -123,6 +123,11 @@ private void saveMeasures(InputFile inputFile, SourceFile squidFile) { context.saveMeasure(inputFile, CoreMetrics.LINES, squidFile.getDouble(ObjectiveCMetric.LINES)); context.saveMeasure(inputFile, CoreMetrics.NCLOC, squidFile.getDouble(ObjectiveCMetric.LINES_OF_CODE)); context.saveMeasure(inputFile, CoreMetrics.COMMENT_LINES, squidFile.getDouble(ObjectiveCMetric.COMMENT_LINES)); + /* + * Not implemented + */ + //context.saveMeasure(inputFile, CoreMetrics.CLASSES, squidFile.getDouble(ObjectiveCMetric.CLASSES)); + //context.saveMeasure(inputFile, CoreMetrics.STATEMENTS, squidFile.getDouble(ObjectiveCMetric.STATEMENTS)); /* * Saving the same measure more than once per file throws exception. That is why * CoreMetrics.FUNCTIONS and CoreMetrics.COMPLEXITY are not allowed to be saved here. In order for the @@ -130,7 +135,6 @@ private void saveMeasures(InputFile inputFile, SourceFile squidFile) { * moved to Lizard classes. */ //context.saveMeasure(inputFile, CoreMetrics.FUNCTIONS, squidFile.getDouble(ObjectiveCMetric.FUNCTIONS)); - context.saveMeasure(inputFile, CoreMetrics.STATEMENTS, squidFile.getDouble(ObjectiveCMetric.STATEMENTS)); //context.saveMeasure(inputFile, CoreMetrics.COMPLEXITY, squidFile.getDouble(ObjectiveCMetric.COMPLEXITY)); } @@ -165,7 +169,7 @@ private void saveViolations(InputFile inputFile, SourceFile squidFile) { @Override public String toString() { - return getClass().getSimpleName(); + return "Objective-C Squid Sensor"; } } diff --git a/src/main/java/org/sonar/plugins/objectivec/colorizer/ObjectiveCColorizerFormat.java b/src/main/java/org/sonar/plugins/objectivec/colorizer/ObjectiveCColorizerFormat.java index 3f5ea9f8..9ab68a6a 100644 --- a/src/main/java/org/sonar/plugins/objectivec/colorizer/ObjectiveCColorizerFormat.java +++ b/src/main/java/org/sonar/plugins/objectivec/colorizer/ObjectiveCColorizerFormat.java @@ -19,8 +19,7 @@ */ package org.sonar.plugins.objectivec.colorizer; -import java.util.List; - +import com.google.common.collect.ImmutableList; import org.sonar.api.web.CodeColorizerFormat; import org.sonar.colorizer.CDocTokenizer; import org.sonar.colorizer.CppDocTokenizer; @@ -29,9 +28,9 @@ import org.sonar.colorizer.StringTokenizer; import org.sonar.colorizer.Tokenizer; import org.sonar.objectivec.api.ObjectiveCKeyword; -import org.sonar.plugins.objectivec.core.ObjectiveC; +import org.sonar.plugins.objectivec.ObjectiveC; -import com.google.common.collect.ImmutableList; +import java.util.List; public class ObjectiveCColorizerFormat extends CodeColorizerFormat { diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java deleted file mode 100644 index eeee8279..00000000 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardMeasurePersistor.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology - * dev@sonar.codehaus.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.objectivec.complexity; - -import org.slf4j.LoggerFactory; -import org.sonar.api.batch.SensorContext; -import org.sonar.api.measures.Measure; -import org.sonar.api.resources.Project; - -import java.io.File; -import java.util.List; -import java.util.Map; - -/** - * This class is used to save the measures created by the lizardReportParser in the sonar database - * - * @author Andres Gil Herrera - * @since 28/05/15. - */ -public class LizardMeasurePersistor { - - private Project project; - private SensorContext sensorContext; - - public LizardMeasurePersistor(final Project p, final SensorContext c) { - this.project = p; - this.sensorContext = c; - } - - /** - * - * @param measures Map containing as key the name of the file and as value a list containing the measures for that file - */ - public void saveMeasures(final Map> measures) { - - if (measures == null) { - return; - } - - for (Map.Entry> entry : measures.entrySet()) { - final org.sonar.api.resources.File objcfile = org.sonar.api.resources.File.fromIOFile(new File(project.getFileSystem().getBasedir(), entry.getKey()), project); - if (fileExists(sensorContext, objcfile)) { - for (Measure measure : entry.getValue()) { - try { - LoggerFactory.getLogger(getClass()).debug("Save measure {} for file {}", measure.getMetric().getName(), objcfile); - sensorContext.saveMeasure(objcfile, measure); - } catch (Exception e) { - LoggerFactory.getLogger(getClass()).error(" Exception -> {} -> {}", entry.getKey(), measure.getMetric().getName()); - } - } - } - } - } - - /** - * - * @param context context of the sensor - * @param file file to prove for - * @return true if the resource is indexed and false if not - */ - private boolean fileExists(final SensorContext context, - final org.sonar.api.resources.File file) { - return context.getResource(file) != null; - } -} diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java index 3a4daf5a..fcabb2d7 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java @@ -19,14 +19,19 @@ */ package org.sonar.plugins.objectivec.complexity; +import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.sonar.api.measures.*; +import org.sonar.api.measures.CoreMetrics; +import org.sonar.api.measures.Measure; +import org.sonar.api.measures.PersistenceMode; +import org.sonar.api.measures.RangeDistributionBuilder; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; import org.xml.sax.SAXException; +import javax.annotation.CheckForNull; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.ParserConfigurationException; @@ -40,16 +45,14 @@ /** * This class parses xml Reports form the tool Lizard in order to extract this measures: - * COMPLEXITY, FUNCTIONS, FUNCTION_COMPLEXITY, FUNCTION_COMPLEXITY_DISTRIBUTION, - * FILE_COMPLEXITY, FUNCTION_COMPLEXITY_DISTRIBUTION, COMPLEXITY_IN_FUNCTIONS + * COMPLEXITY, FUNCTIONS, FUNCTION_COMPLEXITY, FUNCTION_COMPLEXITY_DISTRIBUTION, + * FILE_COMPLEXITY, FUNCTION_COMPLEXITY_DISTRIBUTION, COMPLEXITY_IN_FUNCTIONS * * @author Andres Gil Herrera * @since 28/05/15 */ -public class LizardReportParser { - - private final Number[] FUNCTIONS_DISTRIB_BOTTOM_LIMITS = {1, 2, 4, 6, 8, 10, 12, 20, 30}; - private final Number[] FILES_DISTRIB_BOTTOM_LIMITS = {0, 5, 10, 20, 30, 60, 90}; +public final class LizardReportParser { + private static final Logger LOGGER = LoggerFactory.getLogger(LizardReportParser.class); private static final String MEASURE = "measure"; private static final String MEASURE_TYPE = "type"; @@ -61,34 +64,40 @@ public class LizardReportParser { private static final int CYCLOMATIC_COMPLEXITY_INDEX = 2; private static final int FUNCTIONS_INDEX = 3; + private static final Number[] FUNCTIONS_DISTRIB_BOTTOM_LIMITS = {1, 2, 4, 6, 8, 10, 12, 20, 30}; + private static final Number[] FILES_DISTRIB_BOTTOM_LIMITS = {0, 5, 10, 20, 30, 60, 90}; + + private LizardReportParser() { + // Prevent outside instantiation + } + /** - * * @param xmlFile lizard xml report * @return Map containing as key the name of the file and as value a list containing the measures for that file */ - public Map> parseReport(final File xmlFile) { + @CheckForNull + public static Map> parseReport(final File xmlFile) { Map> result = null; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try { DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.parse(xmlFile); - result = parseFile(document); - } catch (final FileNotFoundException e){ - LoggerFactory.getLogger(getClass()).error("Lizard Report not found {}", xmlFile, e); + result = new LizardReportParser().parseFile(document); + } catch (final FileNotFoundException e) { + LOGGER.error("Lizard Report not found {}", xmlFile, e); } catch (final IOException e) { - LoggerFactory.getLogger(getClass()).error("Error processing file named {}", xmlFile, e); + LOGGER.error("Error processing file named {}", xmlFile, e); } catch (final ParserConfigurationException e) { - LoggerFactory.getLogger(getClass()).error("Error parsing file named {}", xmlFile, e); + LOGGER.error("Error parsing file named {}", xmlFile, e); } catch (final SAXException e) { - LoggerFactory.getLogger(getClass()).error("Error processing file named {}", xmlFile, e); + LOGGER.error("Error processing file named {}", xmlFile, e); } return result; } /** - * * @param document Document object representing the lizard report * @return Map containing as key the name of the file and as value a list containing the measures for that file */ @@ -106,7 +115,7 @@ private Map> parseFile(Document document) { if (element.getAttribute(MEASURE_TYPE).equalsIgnoreCase(FILE_MEASURE)) { NodeList itemList = element.getElementsByTagName(MEASURE_ITEM); addComplexityFileMeasures(itemList, reportMeasures); - } else if(element.getAttribute(MEASURE_TYPE).equalsIgnoreCase(FUNCTION_MEASURE)) { + } else if (element.getAttribute(MEASURE_TYPE).equalsIgnoreCase(FUNCTION_MEASURE)) { NodeList itemList = element.getElementsByTagName(MEASURE_ITEM); collectFunctions(itemList, functions); } @@ -121,10 +130,10 @@ private Map> parseFile(Document document) { /** * This method extracts the values for COMPLEXITY, FUNCTIONS, FILE_COMPLEXITY * - * @param itemList list of all items from a + * @param itemList list of all items from a * @param reportMeasures map to save the measures for each file */ - private void addComplexityFileMeasures(NodeList itemList, Map> reportMeasures){ + private void addComplexityFileMeasures(NodeList itemList, Map> reportMeasures) { for (int i = 0; i < itemList.getLength(); i++) { Node item = itemList.item(i); @@ -134,7 +143,7 @@ private void addComplexityFileMeasures(NodeList itemList, Map buildMeasureList(int complexity, double fileComplexity, int numberOfFunctions){ + private List buildMeasureList(int complexity, double fileComplexity, int numberOfFunctions) { List list = new ArrayList(); list.add(new Measure(CoreMetrics.COMPLEXITY).setIntValue(complexity)); list.add(new Measure(CoreMetrics.FUNCTIONS).setIntValue(numberOfFunctions)); @@ -160,8 +168,7 @@ private List buildMeasureList(int complexity, double fileComplexity, in } /** - * - * @param itemList NodeList of all items in a tag + * @param itemList NodeList of all items in a tag * @param functions list to save the functions in the NodeList as ObjCFunction objects. */ private void collectFunctions(NodeList itemList, List functions) { @@ -177,12 +184,12 @@ private void collectFunctions(NodeList itemList, List functions) { } /** - * * @param reportMeasures map to save the measures for the different files - * @param functions list of ObjCFunction to extract the information needed to create - * FUNCTION_COMPLEXITY_DISTRIBUTION, FUNCTION_COMPLEXITY, COMPLEXITY_IN_FUNCTIONS + * @param functions list of ObjCFunction to extract the information needed to create + * FUNCTION_COMPLEXITY_DISTRIBUTION, FUNCTION_COMPLEXITY, COMPLEXITY_IN_FUNCTIONS */ - private void addComplexityFunctionMeasures(Map> reportMeasures, List functions){ + private void addComplexityFunctionMeasures(Map> reportMeasures, + List functions) { for (Map.Entry> entry : reportMeasures.entrySet()) { RangeDistributionBuilder complexityDistribution = new RangeDistributionBuilder(CoreMetrics.FUNCTION_COMPLEXITY_DISTRIBUTION, FUNCTIONS_DISTRIB_BOTTOM_LIMITS); @@ -199,27 +206,27 @@ private void addComplexityFunctionMeasures(Map> reportMeas if (count != 0) { double complex = 0; - for (Measure m : entry.getValue()){ - if (m.getMetric().getKey().equalsIgnoreCase(CoreMetrics.FILE_COMPLEXITY.getKey())){ + for (Measure m : entry.getValue()) { + if (m.getMetric().getKey().equalsIgnoreCase(CoreMetrics.FILE_COMPLEXITY.getKey())) { complex = m.getValue(); break; } } - double complexMean = complex/(double)count; + double complexMean = complex / (double) count; entry.getValue().addAll(buildFuncionMeasuresList(complexMean, complexityInFunctions, complexityDistribution)); } } } /** - * - * @param complexMean average complexity per function in a file + * @param complexMean average complexity per function in a file * @param complexityInFunctions Entire complexity in functions - * @param builder Builder ready to build FUNCTION_COMPLEXITY_DISTRIBUTION + * @param builder Builder ready to build FUNCTION_COMPLEXITY_DISTRIBUTION * @return list of Measures containing FUNCTION_COMPLEXITY_DISTRIBUTION, FUNCTION_COMPLEXITY and COMPLEXITY_IN_FUNCTIONS */ - public List buildFuncionMeasuresList(double complexMean, int complexityInFunctions, RangeDistributionBuilder builder){ + public List buildFuncionMeasuresList(double complexMean, int complexityInFunctions, + RangeDistributionBuilder builder) { List list = new ArrayList(); list.add(new Measure(CoreMetrics.FUNCTION_COMPLEXITY, complexMean)); list.add(new Measure(CoreMetrics.COMPLEXITY_IN_FUNCTIONS).setIntValue(complexityInFunctions)); diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java index 168f11a9..319a037c 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java @@ -17,9 +17,10 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ - package org.sonar.plugins.objectivec.complexity; +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.batch.Sensor; import org.sonar.api.batch.SensorContext; @@ -27,8 +28,8 @@ import org.sonar.api.config.Settings; import org.sonar.api.measures.Measure; import org.sonar.api.resources.Project; -import org.sonar.plugins.objectivec.ObjectiveCPlugin; -import org.sonar.plugins.objectivec.core.ObjectiveC; +import org.sonar.api.scan.filesystem.PathResolver; +import org.sonar.plugins.objectivec.ObjectiveC; import java.io.File; import java.util.List; @@ -41,69 +42,68 @@ * @author Andres Gil Herrera * @since 28/05/15 */ -@SuppressWarnings("deprecation") -public class LizardSensor implements Sensor { +public final class LizardSensor implements Sensor { + private static final Logger LOGGER = LoggerFactory.getLogger(LizardSensor.class); - public static final String REPORT_PATH_KEY = ObjectiveCPlugin.PROPERTY_PREFIX - + ".lizard.report"; - public static final String DEFAULT_REPORT_PATH = "sonar-reports/lizard-report.xml"; + public static final String REPORT_PATH_KEY = "sonar.objectivec.lizard.reportPath"; - private final Settings conf; private final FileSystem fileSystem; + private final PathResolver pathResolver; + private final Settings settings; - public LizardSensor(final FileSystem moduleFileSystem, final Settings config) { - this.conf = config; - this.fileSystem = moduleFileSystem; + public LizardSensor(final FileSystem fileSystem, final PathResolver pathResolver, final Settings settings) { + this.fileSystem = fileSystem; + this.pathResolver = pathResolver; + this.settings = settings; } - /** - * - * @param project - * @return true if the project is root the root project and uses Objective-C - */ @Override public boolean shouldExecuteOnProject(Project project) { - return project.isRoot() && fileSystem.languages().contains(ObjectiveC.KEY); + return StringUtils.isNotEmpty(settings.getString(REPORT_PATH_KEY)) + && fileSystem.languages().contains(ObjectiveC.KEY); } - /** - * - * @param project - * @param sensorContext - */ @Override - public void analyse(Project project, SensorContext sensorContext) { - final String projectBaseDir = project.getFileSystem().getBasedir().getPath(); - Map> measures = parseReportsIn(projectBaseDir, new LizardReportParser()); - LoggerFactory.getLogger(getClass()).info("Saving results of complexity analysis"); - new LizardMeasurePersistor(project, sensorContext).saveMeasures(measures); - } + public void analyse(Project project, SensorContext context) { + String path = settings.getString(REPORT_PATH_KEY); + File report = pathResolver.relativeFile(fileSystem.baseDir(), path); + + if (!report.isFile()) { + LOGGER.warn("Lizard report not found at {}", report); + return; + } + + LOGGER.info("parsing {}", report); + Map> measures = LizardReportParser.parseReport(report); - /** - * - * @param baseDir base directory of the project to search the report - * @param parser LizardReportParser to parse the report - * @return Map containing as key the name of the file and as value a list containing the measures for that file - */ - private Map> parseReportsIn(final String baseDir, LizardReportParser parser) { - final StringBuilder reportFileName = new StringBuilder(); - if (!(new File(reportPath()).isAbsolute())) { - reportFileName.append(baseDir).append("/"); + if (measures == null) { + return; } - reportFileName.append(reportPath()); - LoggerFactory.getLogger(getClass()).info("Processing complexity report "); - return parser.parseReport(new File(reportFileName.toString())); + + LOGGER.info("Saving results of complexity analysis"); + saveMeasures(project, context, measures); } - /** - * - * @return the default report path or the one specified in the sonar-project.properties - */ - private String reportPath() { - String reportPath = conf.getString(REPORT_PATH_KEY); - if (reportPath == null) { - reportPath = DEFAULT_REPORT_PATH; + private void saveMeasures(Project project, SensorContext context, final Map> measures) { + for (Map.Entry> entry : measures.entrySet()) { + final org.sonar.api.resources.File file = + org.sonar.api.resources.File.fromIOFile(new File(entry.getKey()), project); + + if (context.getResource(file) != null) { + for (Measure measure : entry.getValue()) { + try { + LOGGER.debug("Save measure {} for file {}", measure.getMetric().getName(), file); + context.saveMeasure(file, measure); + } catch (Exception e) { + LOGGER.error(" Exception -> {} -> {}", entry.getKey(), measure.getMetric().getName()); + } + } + } } - return reportPath; + } + + @Override + public String toString() { + return "Objective-C Lizard Sensor"; } } diff --git a/src/main/java/org/sonar/plugins/objectivec/core/ObjectiveCSourceImporter.java b/src/main/java/org/sonar/plugins/objectivec/core/ObjectiveCSourceImporter.java deleted file mode 100644 index f8776a20..00000000 --- a/src/main/java/org/sonar/plugins/objectivec/core/ObjectiveCSourceImporter.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology - * dev@sonar.codehaus.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.objectivec.core; - -import org.sonar.api.batch.AbstractSourceImporter; -import org.sonar.api.batch.SensorContext; -import org.sonar.api.resources.InputFileUtils; -import org.sonar.api.resources.ProjectFileSystem; - -public class ObjectiveCSourceImporter extends AbstractSourceImporter { - - public ObjectiveCSourceImporter(ObjectiveC objectivec) { - super(objectivec); - } - - protected void analyse(ProjectFileSystem fileSystem, SensorContext context) { - parseDirs(context, InputFileUtils.toFiles(fileSystem.mainFiles(ObjectiveC.KEY)), fileSystem.getSourceDirs(), false, fileSystem.getSourceCharset()); - } - - @Override - public String toString() { - return getClass().getSimpleName(); - } -} diff --git a/src/main/java/org/sonar/plugins/objectivec/core/package-info.java b/src/main/java/org/sonar/plugins/objectivec/core/package-info.java deleted file mode 100644 index 960327d6..00000000 --- a/src/main/java/org/sonar/plugins/objectivec/core/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology - * dev@sonar.codehaus.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -@ParametersAreNonnullByDefault -package org.sonar.plugins.objectivec.core; - -import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/org/sonar/plugins/objectivec/coverage/CoberturaParser.java b/src/main/java/org/sonar/plugins/objectivec/coverage/CoberturaParser.java deleted file mode 100644 index cd333d32..00000000 --- a/src/main/java/org/sonar/plugins/objectivec/coverage/CoberturaParser.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology - * dev@sonar.codehaus.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.objectivec.coverage; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.Map; - -import javax.xml.stream.XMLStreamException; - -import org.slf4j.LoggerFactory; -import org.sonar.api.measures.CoverageMeasuresBuilder; -import org.sonar.api.utils.StaxParser; - -final class CoberturaParser { - public Map parseReport(final File xmlFile) { - Map result = null; - try { - final InputStream reportStream = new FileInputStream(xmlFile); - result = parseReport(reportStream); - reportStream.close(); - } catch (final IOException e) { - LoggerFactory.getLogger(getClass()).error( - "Error processing file named {}", xmlFile, e); - result = new HashMap(); - } - return result; - } - - public Map parseReport( - final InputStream xmlFile) { - - final Map measuresForReport = new HashMap(); - try { - final StaxParser parser = new StaxParser( - new CoberturaXMLStreamHandler(measuresForReport)); - parser.parse(xmlFile); - } catch (final XMLStreamException e) { - LoggerFactory.getLogger(getClass()).error( - "Error while parsing XML stream.", e); - } - return measuresForReport; - } - - @Override - public String toString() { - return getClass().getSimpleName(); - } -} diff --git a/src/main/java/org/sonar/plugins/objectivec/coverage/CoberturaReportParser.java b/src/main/java/org/sonar/plugins/objectivec/coverage/CoberturaReportParser.java new file mode 100644 index 00000000..ecf1a639 --- /dev/null +++ b/src/main/java/org/sonar/plugins/objectivec/coverage/CoberturaReportParser.java @@ -0,0 +1,128 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.plugins.objectivec.coverage; + +import com.google.common.collect.Maps; +import org.apache.commons.lang.StringUtils; +import org.codehaus.staxmate.in.SMHierarchicCursor; +import org.codehaus.staxmate.in.SMInputCursor; +import org.sonar.api.batch.SensorContext; +import org.sonar.api.batch.fs.FileSystem; +import org.sonar.api.measures.CoverageMeasuresBuilder; +import org.sonar.api.measures.Measure; +import org.sonar.api.resources.Project; +import org.sonar.api.resources.Resource; +import org.sonar.api.utils.ParsingUtils; +import org.sonar.api.utils.StaxParser; +import org.sonar.api.utils.XmlParserException; + +import javax.xml.stream.XMLStreamException; +import java.io.File; +import java.text.ParseException; +import java.util.Locale; +import java.util.Map; + +final class CoberturaReportParser { + private final FileSystem fileSystem; + private final Project project; + private final SensorContext context; + + private CoberturaReportParser(FileSystem fileSystem, Project project, SensorContext context) { + this.fileSystem = fileSystem; + this.project = project; + this.context = context; + } + + /** + * Parse a Cobertura xml report and create measures accordingly + */ + public static void parseReport(File xmlFile, FileSystem fileSystem, Project project, SensorContext context) { + new CoberturaReportParser(fileSystem, project, context).parse(xmlFile); + } + + private void parse(File xmlFile) { + try { + StaxParser parser = new StaxParser(new StaxParser.XmlStreamHandler() { + + @Override + public void stream(SMHierarchicCursor rootCursor) throws XMLStreamException { + rootCursor.advance(); + collectPackageMeasures(rootCursor.descendantElementCursor("package")); + } + }); + parser.parse(xmlFile); + } catch (XMLStreamException e) { + throw new XmlParserException(e); + } + } + + private void collectPackageMeasures(SMInputCursor pack) throws XMLStreamException { + while (pack.getNext() != null) { + Map builderByFilename = Maps.newHashMap(); + collectFileMeasures(pack.descendantElementCursor("class"), builderByFilename); + for (Map.Entry entry : builderByFilename.entrySet()) { + String filePath = entry.getKey(); + Resource resource = org.sonar.api.resources.File.fromIOFile(new File(fileSystem.baseDir(), filePath), project); + if (resourceExists(resource)) { + for (Measure measure : entry.getValue().createMeasures()) { + context.saveMeasure(resource, measure); + } + } + } + } + } + + private boolean resourceExists(Resource file) { + return context.getResource(file) != null; + } + + private static void collectFileMeasures(SMInputCursor clazz, + Map builderByFilename) throws XMLStreamException { + while (clazz.getNext() != null) { + String fileName = clazz.getAttrValue("filename"); + CoverageMeasuresBuilder builder = builderByFilename.get(fileName); + if (builder == null) { + builder = CoverageMeasuresBuilder.create(); + builderByFilename.put(fileName, builder); + } + collectFileData(clazz, builder); + } + } + + private static void collectFileData(SMInputCursor clazz, + CoverageMeasuresBuilder builder) throws XMLStreamException { + SMInputCursor line = clazz.childElementCursor("lines").advance().childElementCursor("line"); + while (line.getNext() != null) { + int lineId = Integer.parseInt(line.getAttrValue("number")); + try { + builder.setHits(lineId, (int) ParsingUtils.parseNumber(line.getAttrValue("hits"), Locale.ENGLISH)); + } catch (ParseException e) { + throw new XmlParserException(e); + } + + String isBranch = line.getAttrValue("branch"); + String text = line.getAttrValue("condition-coverage"); + if (StringUtils.equals(isBranch, "true") && StringUtils.isNotBlank(text)) { + String[] conditions = StringUtils.split(StringUtils.substringBetween(text, "(", ")"), "/"); + builder.setConditions(lineId, Integer.parseInt(conditions[1]), Integer.parseInt(conditions[0])); + } + } + } +} diff --git a/src/main/java/org/sonar/plugins/objectivec/coverage/CoberturaSensor.java b/src/main/java/org/sonar/plugins/objectivec/coverage/CoberturaSensor.java index 0a900b2b..bc20515f 100644 --- a/src/main/java/org/sonar/plugins/objectivec/coverage/CoberturaSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/coverage/CoberturaSensor.java @@ -19,66 +19,56 @@ */ package org.sonar.plugins.objectivec.coverage; -import java.io.File; -import java.util.HashMap; -import java.util.Map; - +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.sonar.api.batch.CoverageExtension; import org.sonar.api.batch.Sensor; import org.sonar.api.batch.SensorContext; import org.sonar.api.batch.fs.FileSystem; import org.sonar.api.config.Settings; -import org.sonar.api.measures.CoverageMeasuresBuilder; import org.sonar.api.resources.Project; -import org.sonar.plugins.objectivec.ObjectiveCPlugin; -import org.sonar.plugins.objectivec.core.ObjectiveC; +import org.sonar.api.scan.filesystem.PathResolver; +import java.io.File; -public final class CoberturaSensor implements Sensor { - public static final String REPORT_PATTERN_KEY = ObjectiveCPlugin.PROPERTY_PREFIX - + ".coverage.reportPattern"; - public static final String DEFAULT_REPORT_PATTERN = "sonar-reports/coverage*.xml"; +public final class CoberturaSensor implements Sensor, CoverageExtension { + private static final Logger LOGGER = LoggerFactory.getLogger(CoberturaSensor.class); - private final ReportFilesFinder reportFilesFinder; - private final CoberturaParser parser = new CoberturaParser(); + public static final String REPORT_PATH_KEY = "sonar.objectivec.cobertura.reportPath"; - private final Settings conf; private final FileSystem fileSystem; + private final PathResolver pathResolver; + private final Settings settings; - public CoberturaSensor(final FileSystem fileSystem, final Settings config) { - - this.conf = config; + public CoberturaSensor(final FileSystem fileSystem, final PathResolver pathResolver, final Settings settings) { this.fileSystem = fileSystem; - - reportFilesFinder = new ReportFilesFinder(config, REPORT_PATTERN_KEY, DEFAULT_REPORT_PATTERN); + this.pathResolver = pathResolver; + this.settings = settings; } - public boolean shouldExecuteOnProject(final Project project) { - - return project.isRoot() && fileSystem.languages().contains(ObjectiveC.KEY); + @Override + public boolean shouldExecuteOnProject(Project project) { + return StringUtils.isNotEmpty(settings.getString(REPORT_PATH_KEY)); } - public void analyse(final Project project, final SensorContext context) { - final CoverageMeasuresPersistor measuresPersistor = new CoverageMeasuresPersistor( - project, context); - final String projectBaseDir = project.getFileSystem().getBasedir() - .getPath(); - - measuresPersistor.saveMeasures(parseReportsIn(projectBaseDir)); - } + @Override + public void analyse(Project project, SensorContext context) { + String path = settings.getString(REPORT_PATH_KEY); + File report = pathResolver.relativeFile(fileSystem.baseDir(), path); - private Map parseReportsIn( - final String baseDir) { - final Map measuresTotal = new HashMap(); - - for (final File report : reportFilesFinder.reportsIn(baseDir)) { - LoggerFactory.getLogger(getClass()).info( - "Processing coverage report {}", report); - measuresTotal.putAll(parser.parseReport(report)); + if (!report.isFile()) { + LOGGER.warn("Cobertura report not found at {}", report); + return; } - return measuresTotal; + LOGGER.info("parsing {}", report); + CoberturaReportParser.parseReport(report, fileSystem, project, context); } + @Override + public String toString() { + return "Objective-C Cobertura Sensor"; + } } diff --git a/src/main/java/org/sonar/plugins/objectivec/coverage/CoberturaSensor.old b/src/main/java/org/sonar/plugins/objectivec/coverage/CoberturaSensor.old deleted file mode 100644 index 1cdb1303..00000000 --- a/src/main/java/org/sonar/plugins/objectivec/coverage/CoberturaSensor.old +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology - * dev@sonar.codehaus.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ - -package org.sonar.plugins.objectivec.coverage; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.sonar.api.batch.AbstractCoverageExtension; -import org.sonar.api.batch.CoverageExtension; -import org.sonar.api.batch.Sensor; -import org.sonar.api.batch.SensorContext; -import org.sonar.api.resources.Project; -import org.sonar.api.resources.Resource; -import org.sonar.plugins.cobertura.api.AbstractCoberturaParser; -import org.sonar.plugins.cobertura.api.CoberturaUtils; -import org.sonar.plugins.objectivec.core.ObjectiveC; - -import java.io.File; - -public class CoberturaSensor implements Sensor { - - private static final Logger LOG = LoggerFactory.getLogger(CoberturaSensor.class); - - public CoberturaSensor() { - } - - public boolean shouldExecuteOnProject(Project project) { - return ObjectiveC.KEY.equals(project.getLanguageKey()); - } - - public void analyse(Project project, SensorContext context) { - File report = CoberturaUtils.getReport(project); - if (report != null) { - parseReport(report, context); - } - } - - protected void parseReport(File xmlFile, final SensorContext context) { - LOG.info("parsing {}", xmlFile); - COBERTURA_PARSER.parseReport(xmlFile, context); - } - - private static final AbstractCoberturaParser COBERTURA_PARSER = new AbstractCoberturaParser() { - @Override - protected Resource getResource(String fileName) { - LOG.info("Analyzing {}", fileName); - fileName = fileName.replace(".", "/") + ".m"; - return new org.sonar.api.resources.File(fileName); - } - }; - - @Override - public String toString() { - return "Objective-C CoberturaSensor"; - } - -} \ No newline at end of file diff --git a/src/main/java/org/sonar/plugins/objectivec/coverage/CoberturaXMLStreamHandler.java b/src/main/java/org/sonar/plugins/objectivec/coverage/CoberturaXMLStreamHandler.java deleted file mode 100644 index 44501a4c..00000000 --- a/src/main/java/org/sonar/plugins/objectivec/coverage/CoberturaXMLStreamHandler.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology - * dev@sonar.codehaus.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.objectivec.coverage; - -import java.util.Map; - -import javax.xml.stream.XMLStreamException; - -import org.apache.commons.lang.StringUtils; -import org.codehaus.staxmate.in.SMHierarchicCursor; -import org.codehaus.staxmate.in.SMInputCursor; -import org.sonar.api.measures.CoverageMeasuresBuilder; -import org.sonar.api.utils.StaxParser; - -class CoberturaXMLStreamHandler implements StaxParser.XmlStreamHandler { - private final Map measuresForReport; - - public CoberturaXMLStreamHandler( - final Map data) { - measuresForReport = data; - } - - public void stream(final SMHierarchicCursor rootCursor) - throws XMLStreamException { - rootCursor.advance(); - collectPackageMeasures(rootCursor.descendantElementCursor("package")); - } - - private void collectPackageMeasures(final SMInputCursor pack) - throws XMLStreamException { - while (pack.getNext() != null) { - collectFileMeasures(pack.descendantElementCursor("class")); - } - } - - private void collectFileMeasures(final SMInputCursor clazz) - throws XMLStreamException { - while (clazz.getNext() != null) { - collectFileData(clazz); - } - } - - private void collectFileData(final SMInputCursor clazz) - throws XMLStreamException { - final CoverageMeasuresBuilder builder = builderFor(clazz); - final SMInputCursor line = clazz.childElementCursor("lines").advance() - .childElementCursor("line"); - - while (null != line.getNext()) { - recordCoverageFor(line, builder); - } - } - - private void recordCoverageFor(final SMInputCursor line, - final CoverageMeasuresBuilder builder) throws XMLStreamException { - final int lineId = Integer.parseInt(line.getAttrValue("number")); - final int noHits = (int) Math.min( - Long.parseLong(line.getAttrValue("hits")), Integer.MAX_VALUE); - final String isBranch = line.getAttrValue("branch"); - final String conditionText = line.getAttrValue("condition-coverage"); - - builder.setHits(lineId, noHits); - - if (StringUtils.equals(isBranch, "true") - && StringUtils.isNotBlank(conditionText)) { - final String[] conditions = StringUtils.split( - StringUtils.substringBetween(conditionText, "(", ")"), "/"); - builder.setConditions(lineId, Integer.parseInt(conditions[1]), - Integer.parseInt(conditions[0])); - } - } - - private CoverageMeasuresBuilder builderFor(final SMInputCursor clazz) - throws XMLStreamException { - final String fileName = clazz.getAttrValue("filename"); - CoverageMeasuresBuilder builder = measuresForReport.get(fileName); - if (builder == null) { - builder = CoverageMeasuresBuilder.create(); - measuresForReport.put(fileName, builder); - } - return builder; - } -} \ No newline at end of file diff --git a/src/main/java/org/sonar/plugins/objectivec/coverage/CoverageMeasuresPersistor.java b/src/main/java/org/sonar/plugins/objectivec/coverage/CoverageMeasuresPersistor.java deleted file mode 100644 index d46ee0fa..00000000 --- a/src/main/java/org/sonar/plugins/objectivec/coverage/CoverageMeasuresPersistor.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology - * dev@sonar.codehaus.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.objectivec.coverage; - -import java.io.File; -import java.util.List; -import java.util.Map; - -import com.google.common.base.Joiner; -import com.google.common.collect.Lists; -import org.slf4j.LoggerFactory; -import org.sonar.api.batch.SensorContext; -import org.sonar.api.measures.CoverageMeasuresBuilder; -import org.sonar.api.measures.Measure; -import org.sonar.api.resources.Project; -import org.sonar.api.scan.filesystem.PathResolver; -import org.sonar.api.utils.PathUtils; - -final class CoverageMeasuresPersistor { - private final Project project; - private final SensorContext context; - - public CoverageMeasuresPersistor(final Project p, final SensorContext c) { - project = p; - context = c; - } - - public void saveMeasures(final Map coverageMeasures) { - - for (final Map.Entry entry : coverageMeasures.entrySet()) { - saveMeasuresForFile(entry.getValue(), entry.getKey()); - } - } - - private void saveMeasuresForFile(final CoverageMeasuresBuilder measureBuilder, final String filePath) { - - LoggerFactory.getLogger(getClass()).debug("Saving measures for {}", filePath); - final org.sonar.api.resources.File objcfile = org.sonar.api.resources.File.fromIOFile(new File(project.getFileSystem().getBasedir(), filePath), project); - - if (fileExists(context, objcfile)) { - LoggerFactory.getLogger(getClass()).debug( - "File {} was found in the project.", filePath); - saveMeasures(measureBuilder, objcfile); - } - } - - private void saveMeasures(final CoverageMeasuresBuilder measureBuilder, - final org.sonar.api.resources.File objcfile) { - for (final Measure measure : measureBuilder.createMeasures()) { - LoggerFactory.getLogger(getClass()).debug("Measure {}", - measure.getMetric().getName()); - context.saveMeasure(objcfile, measure); - } - } - - private boolean fileExists(final SensorContext context, - final org.sonar.api.resources.File file) { - return context.getResource(file) != null; - } -} diff --git a/src/main/java/org/sonar/plugins/objectivec/coverage/ReportFilesFinder.java b/src/main/java/org/sonar/plugins/objectivec/coverage/ReportFilesFinder.java deleted file mode 100644 index 831327a9..00000000 --- a/src/main/java/org/sonar/plugins/objectivec/coverage/ReportFilesFinder.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology - * dev@sonar.codehaus.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.objectivec.coverage; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.apache.tools.ant.DirectoryScanner; -import org.sonar.api.config.Settings; - -final class ReportFilesFinder { - private final Settings conf; - private final String settingsKey; - private final String settingsDefault; - - public ReportFilesFinder(final Settings settings, final String key, - final String defaultValue) { - conf = settings; - settingsKey = key; - settingsDefault = defaultValue; - } - - public List reportsIn(final String baseDirPath) { - final String[] relPaths = filesMathingPattern(baseDirPath, - reportPattern()); - - final List reports = new ArrayList(); - for (final String relPath : relPaths) { - reports.add(new File(baseDirPath, relPath)); - } - - return reports; - } - - private String[] filesMathingPattern(final String baseDirPath, - final String reportPath) { - final DirectoryScanner scanner = new DirectoryScanner(); - scanner.setIncludes(new String[] { reportPath }); - scanner.setBasedir(new File(baseDirPath)); - scanner.scan(); - return scanner.getIncludedFiles(); - } - - private String reportPattern() { - String reportPath = conf.getString(settingsKey); - if (reportPath == null) { - reportPath = settingsDefault; - } - return reportPath; - } - -} \ No newline at end of file diff --git a/src/main/java/org/sonar/plugins/objectivec/cpd/ObjectiveCCpdMapping.java b/src/main/java/org/sonar/plugins/objectivec/cpd/ObjectiveCCpdMapping.java index 4cf0fc5b..b3622f7c 100644 --- a/src/main/java/org/sonar/plugins/objectivec/cpd/ObjectiveCCpdMapping.java +++ b/src/main/java/org/sonar/plugins/objectivec/cpd/ObjectiveCCpdMapping.java @@ -19,23 +19,21 @@ */ package org.sonar.plugins.objectivec.cpd; -import java.nio.charset.Charset; - import net.sourceforge.pmd.cpd.Tokenizer; - import org.sonar.api.batch.AbstractCpdMapping; +import org.sonar.api.batch.fs.FileSystem; import org.sonar.api.resources.Language; -import org.sonar.api.resources.ProjectFileSystem; -import org.sonar.plugins.objectivec.core.ObjectiveC; +import org.sonar.plugins.objectivec.ObjectiveC; -public class ObjectiveCCpdMapping extends AbstractCpdMapping { +import java.nio.charset.Charset; +public class ObjectiveCCpdMapping extends AbstractCpdMapping { private final ObjectiveC language; private final Charset charset; - public ObjectiveCCpdMapping(ObjectiveC language, ProjectFileSystem fs) { + public ObjectiveCCpdMapping(ObjectiveC language, FileSystem fileSystem) { this.language = language; - this.charset = fs.getSourceCharset(); + this.charset = fileSystem.encoding(); } public Tokenizer getTokenizer() { @@ -45,5 +43,4 @@ public Tokenizer getTokenizer() { public Language getLanguage() { return language; } - } diff --git a/src/main/java/org/sonar/plugins/objectivec/cpd/ObjectiveCTokenizer.java b/src/main/java/org/sonar/plugins/objectivec/cpd/ObjectiveCTokenizer.java index bf180f7c..3ae13274 100644 --- a/src/main/java/org/sonar/plugins/objectivec/cpd/ObjectiveCTokenizer.java +++ b/src/main/java/org/sonar/plugins/objectivec/cpd/ObjectiveCTokenizer.java @@ -19,21 +19,19 @@ */ package org.sonar.plugins.objectivec.cpd; -import java.io.File; -import java.io.IOException; -import java.nio.charset.Charset; -import java.util.List; - +import com.sonar.sslr.api.Token; +import com.sonar.sslr.impl.Lexer; import net.sourceforge.pmd.cpd.SourceCode; import net.sourceforge.pmd.cpd.TokenEntry; import net.sourceforge.pmd.cpd.Tokenizer; import net.sourceforge.pmd.cpd.Tokens; - import org.sonar.objectivec.ObjectiveCConfiguration; import org.sonar.objectivec.lexer.ObjectiveCLexer; -import com.sonar.sslr.api.Token; -import com.sonar.sslr.impl.Lexer; +import java.io.File; +import java.io.IOException; +import java.nio.charset.Charset; +import java.util.List; public class ObjectiveCTokenizer implements Tokenizer { diff --git a/src/main/java/org/sonar/plugins/objectivec/issues/ClangPlistParser.java b/src/main/java/org/sonar/plugins/objectivec/issues/ClangPlistParser.java index cb1d2a1b..b373d9f0 100644 --- a/src/main/java/org/sonar/plugins/objectivec/issues/ClangPlistParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/issues/ClangPlistParser.java @@ -39,9 +39,9 @@ * @author Matthew DeTullio */ public class ClangPlistParser { - private static final Logger LOGGER = LoggerFactory.getLogger(ClangPlistParser.class.getName()); + private static final Logger LOGGER = LoggerFactory.getLogger(ClangPlistParser.class); - public static List parse(File reportsDir) { + public static List parse(final File reportsDir) { List result = new ArrayList(); File[] reports = getReports(reportsDir); @@ -58,7 +58,7 @@ public static List parse(File reportsDir) { } private static File[] getReports(final File reportsDir) { - if (reportsDir == null || !reportsDir.isDirectory() || !reportsDir.exists()) { + if (!reportsDir.isDirectory() || !reportsDir.exists()) { return new File[0]; } diff --git a/src/main/java/org/sonar/plugins/objectivec/issues/ClangRulesDefinition.java b/src/main/java/org/sonar/plugins/objectivec/issues/ClangRulesDefinition.java index 10e0c1ba..87d51820 100644 --- a/src/main/java/org/sonar/plugins/objectivec/issues/ClangRulesDefinition.java +++ b/src/main/java/org/sonar/plugins/objectivec/issues/ClangRulesDefinition.java @@ -21,7 +21,7 @@ import org.sonar.api.server.rule.RulesDefinition; import org.sonar.api.server.rule.RulesDefinitionXmlLoader; -import org.sonar.plugins.objectivec.core.ObjectiveC; +import org.sonar.plugins.objectivec.ObjectiveC; import org.sonar.squidbridge.rules.SqaleXmlLoader; /** diff --git a/src/main/java/org/sonar/plugins/objectivec/issues/ClangSensor.java b/src/main/java/org/sonar/plugins/objectivec/issues/ClangSensor.java index d8d6c77f..daeec72f 100644 --- a/src/main/java/org/sonar/plugins/objectivec/issues/ClangSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/issues/ClangSensor.java @@ -19,6 +19,7 @@ */ package org.sonar.plugins.objectivec.issues; +import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.batch.Sensor; @@ -32,8 +33,7 @@ import org.sonar.api.resources.Project; import org.sonar.api.resources.Resource; import org.sonar.api.rule.RuleKey; -import org.sonar.plugins.objectivec.ObjectiveCPlugin; -import org.sonar.plugins.objectivec.core.ObjectiveC; +import org.sonar.api.scan.filesystem.PathResolver; import java.io.File; import java.util.List; @@ -44,36 +44,43 @@ public class ClangSensor implements Sensor { private static final Logger LOGGER = LoggerFactory.getLogger(ClangSensor.class.getName()); - private static final String REPORT_PATH_KEY = ObjectiveCPlugin.PROPERTY_PREFIX + ".clang.reportsPath"; + public static final String REPORTS_PATH_KEY = "sonar.objectivec.clang.reportsPath"; private final FileSystem fileSystem; + private final PathResolver pathResolver; private final ResourcePerspectives resourcePerspectives; - private final RulesProfile rulesProfile; private final Settings settings; - public ClangSensor(FileSystem fileSystem, ResourcePerspectives resourcePerspectives, RulesProfile rulesProfile, Settings settings) { + public ClangSensor(final FileSystem fileSystem, final PathResolver pathResolver, + final ResourcePerspectives resourcePerspectives, final Settings settings) { this.fileSystem = fileSystem; + this.pathResolver = pathResolver; this.resourcePerspectives = resourcePerspectives; - this.rulesProfile = rulesProfile; this.settings = settings; } @Override public boolean shouldExecuteOnProject(Project project) { - return project.isRoot() && fileSystem.hasFiles(fileSystem.predicates().hasLanguage(ObjectiveC.KEY)) - && !rulesProfile.getActiveRulesByRepository(ClangRulesDefinition.REPOSITORY_KEY).isEmpty(); + return StringUtils.isNotEmpty(settings.getString(REPORTS_PATH_KEY)); } @Override public void analyse(Project project, SensorContext context) { - String reportPath = settings.getString(REPORT_PATH_KEY); - if (reportPath == null) { + String path = settings.getString(REPORTS_PATH_KEY); + File reportsDir = pathResolver.relativeFile(fileSystem.baseDir(), path); + + if (!reportsDir.isDirectory()) { + LOGGER.warn("Clang report directory not found at {}", reportsDir); return; } - LOGGER.info("Processing Clang reports path: {}", reportPath); + collect(project, context, reportsDir); + } + + protected void collect(Project project, SensorContext context, File reportsDir) { + LOGGER.info("parsing {}", reportsDir); - List clangWarnings = ClangPlistParser.parse(new File(reportPath)); + List clangWarnings = ClangPlistParser.parse(reportsDir); for (ClangWarning clangWarning : clangWarnings) { // TODO: Add check for enabled rule if/when rules get split up diff --git a/src/main/java/org/sonar/plugins/objectivec/tests/SurefireParser.java b/src/main/java/org/sonar/plugins/objectivec/tests/SurefireParser.java index b566a92a..3732e061 100644 --- a/src/main/java/org/sonar/plugins/objectivec/tests/SurefireParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/tests/SurefireParser.java @@ -17,13 +17,15 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ - package org.sonar.plugins.objectivec.tests; -import com.sun.swing.internal.plaf.metal.resources.metal_sv; +import com.google.common.collect.ImmutableList; import org.apache.commons.lang.StringEscapeUtils; -import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.sonar.api.batch.SensorContext; +import org.sonar.api.batch.fs.FileSystem; +import org.sonar.api.batch.fs.InputFile; import org.sonar.api.measures.CoreMetrics; import org.sonar.api.measures.Measure; import org.sonar.api.measures.Metric; @@ -33,6 +35,7 @@ import org.sonar.api.utils.ParsingUtils; import org.sonar.api.utils.StaxParser; import org.sonar.api.utils.XmlParserException; +import org.sonar.plugins.objectivec.ObjectiveC; import org.sonar.plugins.surefire.TestCaseDetails; import org.sonar.plugins.surefire.TestSuiteParser; import org.sonar.plugins.surefire.TestSuiteReport; @@ -44,32 +47,34 @@ import java.util.List; import java.util.Set; -/** - * Created by gillesgrousset on 06/01/15. - */ public class SurefireParser { + private static final Logger LOGGER = LoggerFactory.getLogger(SurefireParser.class); + + private final Project project; + private final SensorContext context; + private final FileSystem fileSystem; + + public SurefireParser(Project project, SensorContext context, FileSystem fileSystem) { + this.project = project; + this.context = context; + this.fileSystem = fileSystem; + } - public void collect(Project project, SensorContext context, File reportsDir) { + public void collect(File reportsDir) { File[] xmlFiles = getReports(reportsDir); if (xmlFiles.length == 0) { - insertZeroWhenNoReports(project, context); + insertZeroWhenNoReports(); } else { - parseFiles(context, xmlFiles); + parseFiles(xmlFiles); } } private File[] getReports(File dir) { - if (dir == null || !dir.isDirectory() || !dir.exists()) { + if (!dir.isDirectory() || !dir.exists()) { return new File[0]; } - File[] list = dir.listFiles(new FilenameFilter() { - public boolean accept(File dir, String name) { - return name.startsWith("TEST") && name.endsWith(".xml"); - } - }); - return dir.listFiles(new FilenameFilter() { public boolean accept(File dir, String name) { return name.startsWith("TEST") && name.endsWith(".xml"); @@ -77,13 +82,11 @@ public boolean accept(File dir, String name) { }); } - private void insertZeroWhenNoReports(Project pom, SensorContext context) { - if ( !StringUtils.equalsIgnoreCase("pom", pom.getPackaging())) { - context.saveMeasure(CoreMetrics.TESTS, 0.0); - } + private void insertZeroWhenNoReports() { + context.saveMeasure(CoreMetrics.TESTS, 0.0); } - private void parseFiles(SensorContext context, File[] reports) { + private void parseFiles(File[] reports) { Set analyzedReports = new HashSet(); try { for (File report : reports) { @@ -92,22 +95,22 @@ private void parseFiles(SensorContext context, File[] reports) { parser.parse(report); for (TestSuiteReport fileReport : parserHandler.getParsedReports()) { - if ( !fileReport.isValid() || analyzedReports.contains(fileReport)) { + if (!fileReport.isValid() || analyzedReports.contains(fileReport)) { continue; } if (fileReport.getTests() > 0) { double testsCount = fileReport.getTests() - fileReport.getSkipped(); - saveClassMeasure(context, fileReport, CoreMetrics.SKIPPED_TESTS, fileReport.getSkipped()); - saveClassMeasure(context, fileReport, CoreMetrics.TESTS, testsCount); - saveClassMeasure(context, fileReport, CoreMetrics.TEST_ERRORS, fileReport.getErrors()); - saveClassMeasure(context, fileReport, CoreMetrics.TEST_FAILURES, fileReport.getFailures()); - saveClassMeasure(context, fileReport, CoreMetrics.TEST_EXECUTION_TIME, fileReport.getTimeMS()); + saveClassMeasure(fileReport, CoreMetrics.SKIPPED_TESTS, fileReport.getSkipped()); + saveClassMeasure(fileReport, CoreMetrics.TESTS, testsCount); + saveClassMeasure(fileReport, CoreMetrics.TEST_ERRORS, fileReport.getErrors()); + saveClassMeasure(fileReport, CoreMetrics.TEST_FAILURES, fileReport.getFailures()); + saveClassMeasure(fileReport, CoreMetrics.TEST_EXECUTION_TIME, fileReport.getTimeMS()); double passedTests = testsCount - fileReport.getErrors() - fileReport.getFailures(); if (testsCount > 0) { double percentage = passedTests * 100d / testsCount; - saveClassMeasure(context, fileReport, CoreMetrics.TEST_SUCCESS_DENSITY, ParsingUtils.scaleValue(percentage)); + saveClassMeasure(fileReport, CoreMetrics.TEST_SUCCESS_DENSITY, ParsingUtils.scaleValue(percentage)); } - saveTestsDetails(context, fileReport); + saveTestsDetails(fileReport); analyzedReports.add(fileReport); } } @@ -118,7 +121,7 @@ private void parseFiles(SensorContext context, File[] reports) { } } - private void saveTestsDetails(SensorContext context, TestSuiteReport fileReport) throws TransformerException { + private void saveTestsDetails(TestSuiteReport fileReport) throws TransformerException { StringBuilder testCaseDetails = new StringBuilder(256); testCaseDetails.append(""); List details = fileReport.getDetails(); @@ -141,26 +144,52 @@ private void saveTestsDetails(SensorContext context, TestSuiteReport fileReport) context.saveMeasure(getUnitTestResource(fileReport.getClassKey()), new Measure(CoreMetrics.TEST_DATA, testCaseDetails.toString())); } - private void saveClassMeasure(SensorContext context, TestSuiteReport fileReport, Metric metric, double value) { - if ( !Double.isNaN(value)) { + private void saveClassMeasure(TestSuiteReport fileReport, Metric metric, double value) { + if (!Double.isNaN(value)) { - String basename = fileReport.getClassKey().replace('.', '/'); + String className = fileReport.getClassKey(); - // .m file - context.saveMeasure(getUnitTestResource(basename + ".m"), metric, value); + context.saveMeasure(getUnitTestResource(className), metric, value); - // Try .m file with + in name + // Try with + in name try { - context.saveMeasure(getUnitTestResource(basename.replace('_', '+') + ".m"), metric, value); + context.saveMeasure(getUnitTestResource(className.replace('_', '+')), metric, value); } catch (Exception e) { - // Nothing : File was probably already registered successfully + // no-op - file was probably already registered successfully } } } - public Resource getUnitTestResource(String filename) { + public Resource getUnitTestResource(String classname) { + String fileName = classname.replace('.', '/') + ".m"; + + File file = new File(fileName); + if (!file.isAbsolute()) { + file = new File(fileSystem.baseDir(), fileName); + } + + /* + * Most xcodebuild JUnit parsers don't include the path to the class in the class field, so search for if it + * wasn't found in the root. + */ + if (!file.isFile() || !file.exists()) { + List files = ImmutableList.copyOf(fileSystem.files(fileSystem.predicates().and( + fileSystem.predicates().hasLanguage(ObjectiveC.KEY), + fileSystem.predicates().hasType(InputFile.Type.TEST), + fileSystem.predicates().matchesPathPattern("**/" + fileName)))); + + if (files.isEmpty()) { + LOGGER.info("Unable to locate test source file {}", fileName); + } else { + /* + * Lazily get the first file, since we wouldn't be able to determine the correct one from just the + * test class name in the event that there are multiple matches. + */ + file = files.get(0); + } + } - org.sonar.api.resources.File sonarFile = new org.sonar.api.resources.File(filename); + org.sonar.api.resources.File sonarFile = org.sonar.api.resources.File.fromIOFile(file, project); sonarFile.setQualifier(Qualifiers.UNIT_TEST_FILE); return sonarFile; } diff --git a/src/main/java/org/sonar/plugins/objectivec/tests/SurefireSensor.java b/src/main/java/org/sonar/plugins/objectivec/tests/SurefireSensor.java index 207a430f..a7b0db82 100644 --- a/src/main/java/org/sonar/plugins/objectivec/tests/SurefireSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/tests/SurefireSensor.java @@ -17,84 +17,60 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ - package org.sonar.plugins.objectivec.tests; +import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import org.sonar.api.batch.CoverageExtension; -import org.sonar.api.batch.DependsUpon; import org.sonar.api.batch.Sensor; import org.sonar.api.batch.SensorContext; +import org.sonar.api.batch.fs.FileSystem; import org.sonar.api.config.Settings; import org.sonar.api.resources.Project; -import org.sonar.plugins.objectivec.core.ObjectiveC; +import org.sonar.api.scan.filesystem.PathResolver; import java.io.File; public class SurefireSensor implements Sensor { + private static final Logger LOGGER = LoggerFactory.getLogger(SurefireSensor.class); - private static final Logger LOG = LoggerFactory.getLogger(SurefireSensor.class); - public static final String REPORT_PATH_KEY = "sonar.junit.reportsPath"; - public static final String DEFAULT_REPORT_PATH = "sonar-reports/"; - private final Settings conf; - - public SurefireSensor() { - this(null); - } + public static final String REPORTS_PATH_KEY = "sonar.objectivec.junit.reportsPath"; - public SurefireSensor(final Settings config) { - conf = config; - } + private final FileSystem fileSystem; + private final PathResolver pathResolver; + private final Settings settings; - @DependsUpon - public Class dependsUponCoverageSensors() { - return CoverageExtension.class; + public SurefireSensor(FileSystem fileSystem, PathResolver pathResolver, Settings settings) { + this.fileSystem = fileSystem; + this.pathResolver = pathResolver; + this.settings = settings; } + @Override public boolean shouldExecuteOnProject(Project project) { - return ObjectiveC.KEY.equals(project.getLanguageKey()); + return StringUtils.isNotEmpty(settings.getString(REPORTS_PATH_KEY)); } + @Override public void analyse(Project project, SensorContext context) { + String path = settings.getString(REPORTS_PATH_KEY); + File reportsDir = pathResolver.relativeFile(fileSystem.baseDir(), path); - /* - GitHub Issue #50 - Formerly we used SurefireUtils.getReportsDirectory(project). It seems that is this one: - http://grepcode.com/file/repo1.maven.org/maven2/org.codehaus.sonar.plugins/sonar-surefire-plugin/3.3.2/org/sonar/plugins/surefire/api/SurefireUtils.java?av=f#34 - However it turns out that the Java plugin contains its own version of SurefireUtils - that is very different (and does not contain a matching method). - That seems to be this one: http://svn.codehaus.org/sonar-plugins/tags/sonar-groovy-plugin-0.5/src/main/java/org/sonar/plugins/groovy/surefire/SurefireSensor.java - - The result is as follows: - - 1. At runtime getReportsDirectory(project) fails if you have the Java plugin installed - 2. At build time the new getReportsDirectory(project,settings) because I guess something in the build chain doesn't know about the Java plugin version - - So the implementation here reaches into the project properties and pulls the path out by itself. - */ + if (!reportsDir.isDirectory()) { + LOGGER.warn("JUnit report directory not found at {}", reportsDir); + return; + } - collect(project, context, new File(reportPath())); + collect(project, context, reportsDir); } protected void collect(Project project, SensorContext context, File reportsDir) { - LOG.info("parsing {}", reportsDir); - SUREFIRE_PARSER.collect(project, context, reportsDir); + LOGGER.info("parsing {}", reportsDir); + new SurefireParser(project, context, fileSystem).collect(reportsDir); } - private static final SurefireParser SUREFIRE_PARSER = new SurefireParser(); - @Override public String toString() { - return "Objective-C SurefireSensor"; + return "Objective-C Surefire Sensor"; } - - private String reportPath() { - String reportPath = conf.getString(REPORT_PATH_KEY); - if (reportPath == null) { - reportPath = DEFAULT_REPORT_PATH; - } - return reportPath; - } - } \ No newline at end of file diff --git a/src/main/java/org/sonar/plugins/objectivec/violations/OCLintParser.java b/src/main/java/org/sonar/plugins/objectivec/violations/OCLintParser.java index a16b9278..e5344db0 100644 --- a/src/main/java/org/sonar/plugins/objectivec/violations/OCLintParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/violations/OCLintParser.java @@ -19,57 +19,92 @@ */ package org.sonar.plugins.objectivec.violations; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Collection; - -import javax.xml.stream.XMLStreamException; - +import org.codehaus.staxmate.in.SMHierarchicCursor; +import org.codehaus.staxmate.in.SMInputCursor; +import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.batch.SensorContext; +import org.sonar.api.component.ResourcePerspectives; +import org.sonar.api.issue.Issuable; +import org.sonar.api.issue.Issue; import org.sonar.api.resources.Project; -import org.sonar.api.rules.Violation; +import org.sonar.api.rule.RuleKey; import org.sonar.api.utils.StaxParser; +import org.sonar.api.utils.XmlParserException; + +import javax.xml.stream.XMLStreamException; +import java.io.File; final class OCLintParser { + private static final Logger LOGGER = LoggerFactory.getLogger(OCLintParser.class); + private final Project project; private final SensorContext context; + private final ResourcePerspectives resourcePerspectives; - public OCLintParser(final Project p, final SensorContext c) { - project = p; - context = c; + private OCLintParser(final Project project, final SensorContext context, + final ResourcePerspectives resourcePerspectives) { + this.project = project; + this.context = context; + this.resourcePerspectives = resourcePerspectives; } - public Collection parseReport(final File file) { - Collection result; + public static void parseReport(File xmlFile, Project project, SensorContext context, + ResourcePerspectives resourcePerspectives) { + new OCLintParser(project, context, resourcePerspectives).parse(xmlFile); + } + + + private void parse(File xmlFile) { try { - final InputStream reportStream = new FileInputStream(file); - result = parseReport(reportStream); - reportStream.close(); - } catch (final IOException e) { - LoggerFactory.getLogger(getClass()).error( - "Error processing file named {}", file, e); - result = new ArrayList(); + StaxParser parser = new StaxParser(new StaxParser.XmlStreamHandler() { + @Override + public void stream(SMHierarchicCursor rootCursor) throws XMLStreamException { + rootCursor.advance(); + collectFiles(rootCursor.childElementCursor("file")); + } + }); + parser.parse(xmlFile); + } catch (XMLStreamException e) { + throw new XmlParserException(e); } - return result; } - public Collection parseReport(final InputStream inputStream) { - final Collection violations = new ArrayList(); - try { - final StaxParser parser = new StaxParser( - new OCLintXMLStreamHandler(violations, project, context)); - parser.parse(inputStream); - LoggerFactory.getLogger(getClass()).error( - "Reporting {} violations.", violations.size()); - } catch (final XMLStreamException e) { - LoggerFactory.getLogger(getClass()).error( - "Error while parsing XML stream.", e); + private void collectFiles(final SMInputCursor file) throws XMLStreamException { + while (null != file.getNext()) { + final String filePath = file.getAttrValue("name"); + LOGGER.debug("Collecting issues for {}", filePath); + + final org.sonar.api.resources.File resource = org.sonar.api.resources.File.fromIOFile(new File(filePath), project); + + if (context.getResource(resource) != null) { + LOGGER.debug("File {} was found in the project.", filePath); + collectFileIssues(resource, file); + } } - return violations; } + private void collectFileIssues(final org.sonar.api.resources.File resource, + final SMInputCursor file) throws XMLStreamException { + final SMInputCursor line = file.childElementCursor("violation"); + + while (line.getNext() != null) { + recordIssue(resource, line); + } + } + + private void recordIssue(final org.sonar.api.resources.File resource, + final SMInputCursor line) throws XMLStreamException { + Issuable issuable = resourcePerspectives.as(Issuable.class, resource); + + if (issuable != null) { + Issue issue = issuable.newIssueBuilder() + .ruleKey(RuleKey.of(OCLintRulesDefinition.REPOSITORY_KEY, line.getAttrValue("rule"))) + .line(Integer.valueOf(line.getAttrValue("beginline"))) + .message(line.getElemStringValue()) + .build(); + + issuable.addIssue(issue); + } + } } diff --git a/src/main/java/org/sonar/plugins/objectivec/violations/OCLintProfile.java b/src/main/java/org/sonar/plugins/objectivec/violations/OCLintProfile.java index 1e5684d8..976758f1 100644 --- a/src/main/java/org/sonar/plugins/objectivec/violations/OCLintProfile.java +++ b/src/main/java/org/sonar/plugins/objectivec/violations/OCLintProfile.java @@ -19,43 +19,43 @@ */ package org.sonar.plugins.objectivec.violations; -import java.io.InputStreamReader; -import java.io.Reader; - +import com.google.common.io.Closeables; +import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.profiles.ProfileDefinition; import org.sonar.api.profiles.RulesProfile; import org.sonar.api.utils.ValidationMessages; -import org.sonar.plugins.objectivec.core.ObjectiveC; +import org.sonar.plugins.objectivec.ObjectiveC; -import com.google.common.io.Closeables; +import java.io.InputStreamReader; +import java.io.Reader; public final class OCLintProfile extends ProfileDefinition { + private static final Logger LOGGER = LoggerFactory.getLogger(OCLintProfile.class); - private static final String DEFAULT_PROFILE = "/org/sonar/plugins/oclint/profile-oclint.xml"; - private final OCLintProfileImporter profileImporter; + private final OCLintProfileImporter importer; public OCLintProfile(final OCLintProfileImporter importer) { - profileImporter = importer; + this.importer = importer; } @Override public RulesProfile createProfile(final ValidationMessages messages) { - LoggerFactory.getLogger(getClass()).info("Creating OCLint Profile"); - Reader config = null; + LOGGER.info("Creating OCLint Profile"); + Reader profileXmlReader = null; try { - config = new InputStreamReader(getClass().getResourceAsStream( - DEFAULT_PROFILE)); - final RulesProfile profile = profileImporter.importProfile(config, - messages); - profile.setName(OCLintRuleRepository.REPOSITORY_KEY); + profileXmlReader = new InputStreamReader(OCLintProfile.class.getResourceAsStream( + "/org/sonar/plugins/objectivec/profile-oclint.xml")); + + RulesProfile profile = importer.importProfile(profileXmlReader, messages); profile.setLanguage(ObjectiveC.KEY); + profile.setName(OCLintRulesDefinition.REPOSITORY_KEY); profile.setDefaultProfile(true); return profile; } finally { - Closeables.closeQuietly(config); + Closeables.closeQuietly(profileXmlReader); } } } diff --git a/src/main/java/org/sonar/plugins/objectivec/violations/OCLintProfileImporter.java b/src/main/java/org/sonar/plugins/objectivec/violations/OCLintProfileImporter.java index ba174e58..acc06c59 100644 --- a/src/main/java/org/sonar/plugins/objectivec/violations/OCLintProfileImporter.java +++ b/src/main/java/org/sonar/plugins/objectivec/violations/OCLintProfileImporter.java @@ -19,22 +19,24 @@ */ package org.sonar.plugins.objectivec.violations; -import java.io.Reader; - +import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.profiles.ProfileImporter; import org.sonar.api.profiles.RulesProfile; import org.sonar.api.profiles.XMLProfileParser; import org.sonar.api.utils.ValidationMessages; -import org.sonar.plugins.objectivec.core.ObjectiveC; +import org.sonar.plugins.objectivec.ObjectiveC; + +import java.io.Reader; public final class OCLintProfileImporter extends ProfileImporter { + private static final Logger LOGGER = LoggerFactory.getLogger(OCLintProfileImporter.class); private static final String UNABLE_TO_LOAD_DEFAULT_PROFILE = "Unable to load default OCLint profile"; + private final XMLProfileParser profileParser; public OCLintProfileImporter(final XMLProfileParser xmlProfileParser) { - super(OCLintRuleRepository.REPOSITORY_KEY, - OCLintRuleRepository.REPOSITORY_KEY); + super(OCLintRulesDefinition.REPOSITORY_KEY, OCLintRulesDefinition.REPOSITORY_KEY); setSupportedLanguages(ObjectiveC.KEY); profileParser = xmlProfileParser; } @@ -46,8 +48,7 @@ public RulesProfile importProfile(final Reader reader, if (null == profile) { messages.addErrorText(UNABLE_TO_LOAD_DEFAULT_PROFILE); - LoggerFactory.getLogger(OCLintProfileImporter.class).error( - UNABLE_TO_LOAD_DEFAULT_PROFILE); + LOGGER.error(UNABLE_TO_LOAD_DEFAULT_PROFILE); } return profile; diff --git a/src/main/java/org/sonar/plugins/objectivec/violations/OCLintRuleParser.java b/src/main/java/org/sonar/plugins/objectivec/violations/OCLintRuleParser.java deleted file mode 100644 index 427090c0..00000000 --- a/src/main/java/org/sonar/plugins/objectivec/violations/OCLintRuleParser.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology - * dev@sonar.codehaus.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.objectivec.violations; - -import java.io.BufferedReader; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.io.IOUtils; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.sonar.api.ServerComponent; -import org.sonar.api.rules.Rule; -import org.sonar.api.rules.RulePriority; - -/** - * Largely copied from AndroidLint's equivalent class whose authors are Stephane - * Nicolas and Jerome Van Der Linden according to the class Javadoc. - * - */ -final class OCLintRuleParser implements ServerComponent { - - private static final int OCLINT_MINIMUM_PRIORITY = 4; - private static final Logger LOGGER = LoggerFactory - .getLogger(OCLintRuleParser.class); - - public List parse(final BufferedReader reader) throws IOException { - final List rules = new ArrayList(); - - final List listLines = IOUtils.readLines(reader); - - String previousLine = null; - Rule rule = null; - boolean inDescription = false; - for (String line : listLines) { - if (isLineIgnored(line)) { - inDescription = false; - } else if (line.matches("[\\-]{4,}.*")) { - LOGGER.debug("Rule found : {}", previousLine); - - // remove the rule name from the description of the previous - // rule - if (rule != null) { - final int index = rule.getDescription().lastIndexOf( - previousLine); - if (index > 0) { - rule.setDescription(rule.getDescription().substring(0, - index)); - } - } - - rule = Rule.create(); - rules.add(rule); - rule.setName(previousLine); - rule.setKey(previousLine); - } else if (line.matches("Summary:.*")) { - inDescription = true; - rule.setDescription(line.substring(line.indexOf(':') + 1)); - } else if (line.matches("Category:.*")) { - inDescription = true; - } else if (line.matches("Severity:.*")) { - inDescription = false; - final String severity = line.substring("Severity: ".length()); - // Rules are priority 1, 2 or 3 in OCLint files. - rule.setSeverity(RulePriority.values()[Integer.valueOf(severity)]); - } else { - if (inDescription) { - line = ruleDescriptionLink(line); - rule.setDescription(rule.getDescription() + "
" + line); - } - } - previousLine = line; - } - return rules; - } - - private boolean isLineIgnored(String line) { - return line.matches("\\=.*") || line.matches("Priority:.*"); - } - - private String ruleDescriptionLink(final String line) { - String result = line; - final int indexOfLink = line.indexOf("http://"); - if (0 <= indexOfLink) { - final String link = line.substring(indexOfLink); - final StringBuilder htmlText = new StringBuilder(""); - htmlText.append(link); - htmlText.append(""); - result = htmlText.toString(); - } - return result; - } -} diff --git a/src/main/java/org/sonar/plugins/objectivec/violations/OCLintRuleRepository.java b/src/main/java/org/sonar/plugins/objectivec/violations/OCLintRuleRepository.java deleted file mode 100644 index 47920cea..00000000 --- a/src/main/java/org/sonar/plugins/objectivec/violations/OCLintRuleRepository.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology - * dev@sonar.codehaus.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.objectivec.violations; - -import java.io.BufferedReader; -import java.io.IOException; -import java.io.InputStreamReader; -import java.util.List; - -import org.apache.commons.lang.CharEncoding; -import org.sonar.api.rules.Rule; -import org.sonar.api.rules.RuleRepository; -import org.sonar.api.utils.SonarException; -import org.sonar.plugins.objectivec.core.ObjectiveC; - -import com.google.common.io.Closeables; - -public final class OCLintRuleRepository extends RuleRepository { - public static final String REPOSITORY_KEY = "OCLint"; - public static final String REPOSITORY_NAME = REPOSITORY_KEY; - - private static final String RULES_FILE = "/org/sonar/plugins/oclint/rules.txt"; - - private final OCLintRuleParser ocLintRuleParser = new OCLintRuleParser(); - - public OCLintRuleRepository() { - super(OCLintRuleRepository.REPOSITORY_KEY, ObjectiveC.KEY); - setName(OCLintRuleRepository.REPOSITORY_NAME); - } - - @Override - public List createRules() { - BufferedReader reader = null; - try { - reader = new BufferedReader(new InputStreamReader(getClass() - .getResourceAsStream(RULES_FILE), CharEncoding.UTF_8)); - return ocLintRuleParser.parse(reader); - } catch (final IOException e) { - throw new SonarException("Fail to load the default OCLint rules.", - e); - } finally { - Closeables.closeQuietly(reader); - } - } -} diff --git a/src/main/java/org/sonar/plugins/objectivec/violations/OCLintRulesDefinition.java b/src/main/java/org/sonar/plugins/objectivec/violations/OCLintRulesDefinition.java new file mode 100644 index 00000000..c09bd650 --- /dev/null +++ b/src/main/java/org/sonar/plugins/objectivec/violations/OCLintRulesDefinition.java @@ -0,0 +1,47 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.plugins.objectivec.violations; + +import org.sonar.api.server.rule.RulesDefinition; +import org.sonar.api.server.rule.RulesDefinitionXmlLoader; +import org.sonar.plugins.objectivec.ObjectiveC; +import org.sonar.squidbridge.rules.SqaleXmlLoader; + +public final class OCLintRulesDefinition implements RulesDefinition { + public static final String REPOSITORY_KEY = "OCLint"; + public static final String REPOSITORY_NAME = REPOSITORY_KEY; + + @Override + public void define(Context context) { + NewRepository repository = context + .createRepository(REPOSITORY_KEY, ObjectiveC.KEY) + .setName(REPOSITORY_NAME); + + RulesDefinitionXmlLoader ruleLoader = new RulesDefinitionXmlLoader(); + ruleLoader.load( + repository, + OCLintRulesDefinition.class.getResourceAsStream("/org/sonar/plugins/objectivec/rules-oclint.xml"), + "UTF-8"); + + SqaleXmlLoader.load(repository, "/com/sonar/sqale/oclint-model.xml"); + + repository.done(); + } +} diff --git a/src/main/java/org/sonar/plugins/objectivec/violations/OCLintSensor.java b/src/main/java/org/sonar/plugins/objectivec/violations/OCLintSensor.java index 4847905f..2d5025b8 100644 --- a/src/main/java/org/sonar/plugins/objectivec/violations/OCLintSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/violations/OCLintSensor.java @@ -19,68 +19,56 @@ */ package org.sonar.plugins.objectivec.violations; -import java.io.File; -import java.util.Collection; - +import org.apache.commons.lang.StringUtils; +import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.batch.Sensor; import org.sonar.api.batch.SensorContext; import org.sonar.api.batch.fs.FileSystem; +import org.sonar.api.component.ResourcePerspectives; import org.sonar.api.config.Settings; import org.sonar.api.resources.Project; -import org.sonar.api.rules.Violation; -import org.sonar.plugins.objectivec.ObjectiveCPlugin; -import org.sonar.plugins.objectivec.core.ObjectiveC; +import org.sonar.api.scan.filesystem.PathResolver; + +import java.io.File; public final class OCLintSensor implements Sensor { - public static final String REPORT_PATH_KEY = ObjectiveCPlugin.PROPERTY_PREFIX - + ".oclint.report"; - public static final String DEFAULT_REPORT_PATH = "sonar-reports/oclint.xml"; + private static final Logger LOGGER = LoggerFactory.getLogger(OCLintSensor.class); + + public static final String REPORT_PATH_KEY = "sonar.objectivec.oclint.reportPath"; - private final Settings conf; private final FileSystem fileSystem; + private final PathResolver pathResolver; + private final ResourcePerspectives resourcePerspectives; + private final Settings settings; - public OCLintSensor(final FileSystem moduleFileSystem, final Settings config) { - this.conf = config; - this.fileSystem = moduleFileSystem; + public OCLintSensor(final FileSystem fileSystem, final PathResolver pathResolver, + final ResourcePerspectives resourcePerspectives, final Settings settings) { + this.fileSystem = fileSystem; + this.pathResolver = pathResolver; + this.resourcePerspectives = resourcePerspectives; + this.settings = settings; } public boolean shouldExecuteOnProject(final Project project) { - - return project.isRoot() && fileSystem.languages().contains(ObjectiveC.KEY); - + return StringUtils.isNotEmpty(settings.getString(REPORT_PATH_KEY)); } public void analyse(final Project project, final SensorContext context) { - final String projectBaseDir = project.getFileSystem().getBasedir() - .getPath(); - final OCLintParser parser = new OCLintParser(project, context); - saveViolations(parseReportIn(projectBaseDir, parser), context); - - } + String path = settings.getString(REPORT_PATH_KEY); + File report = pathResolver.relativeFile(fileSystem.baseDir(), path); - private void saveViolations(final Collection violations, - final SensorContext context) { - for (final Violation violation : violations) { - context.saveViolation(violation); + if (!report.isFile()) { + LOGGER.warn("OCLint report not found at {}", report); + return; } - } - - private Collection parseReportIn(final String baseDir, - final OCLintParser parser) { - final StringBuilder reportFileName = new StringBuilder(baseDir); - reportFileName.append("/").append(reportPath()); - LoggerFactory.getLogger(getClass()).info("Processing OCLint report {}", - reportFileName); - return parser.parseReport(new File(reportFileName.toString())); + LOGGER.info("parsing {}", report); + OCLintParser.parseReport(report, project, context, resourcePerspectives); } - private String reportPath() { - String reportPath = conf.getString(REPORT_PATH_KEY); - if (reportPath == null) { - reportPath = DEFAULT_REPORT_PATH; - } - return reportPath; + @Override + public String toString() { + return "Objective-C OCLint Sensor"; } } diff --git a/src/main/java/org/sonar/plugins/objectivec/violations/OCLintXMLStreamHandler.java b/src/main/java/org/sonar/plugins/objectivec/violations/OCLintXMLStreamHandler.java deleted file mode 100644 index 0847046b..00000000 --- a/src/main/java/org/sonar/plugins/objectivec/violations/OCLintXMLStreamHandler.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology - * dev@sonar.codehaus.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.objectivec.violations; - -import java.io.File; -import java.util.Collection; - -import javax.xml.stream.XMLStreamException; - -import org.codehaus.staxmate.in.SMHierarchicCursor; -import org.codehaus.staxmate.in.SMInputCursor; -import org.slf4j.LoggerFactory; -import org.sonar.api.batch.SensorContext; -import org.sonar.api.resources.Project; -import org.sonar.api.rules.Rule; -import org.sonar.api.rules.RulePriority; -import org.sonar.api.rules.Violation; -import org.sonar.api.utils.StaxParser.XmlStreamHandler; - -final class OCLintXMLStreamHandler implements XmlStreamHandler { - private static final int PMD_MINIMUM_PRIORITY = 5; - private final Collection foundViolations; - private final Project project; - private final SensorContext context; - - public OCLintXMLStreamHandler(final Collection violations, - final Project p, final SensorContext c) { - foundViolations = violations; - project = p; - context = c; - } - - public void stream(final SMHierarchicCursor rootCursor) - throws XMLStreamException { - final SMInputCursor file = rootCursor.advance().childElementCursor( - "file"); - - while (null != file.getNext()) { - collectViolationsFor(file); - } - } - - private void collectViolationsFor(final SMInputCursor file) - throws XMLStreamException { - final String filePath = file.getAttrValue("name"); - LoggerFactory.getLogger(getClass()).debug( - "Collection violations for {}", filePath); - final org.sonar.api.resources.File resource = findResource(filePath); - if (fileExists(resource)) { - LoggerFactory.getLogger(getClass()).debug( - "File {} was found in the project.", filePath); - collectFileViolations(resource, file); - } - } - - private org.sonar.api.resources.File findResource(final String filePath) { - return org.sonar.api.resources.File.fromIOFile(new File(filePath), - project); - } - - private void collectFileViolations( - final org.sonar.api.resources.File resource, - final SMInputCursor file) throws XMLStreamException { - final SMInputCursor line = file.childElementCursor("violation"); - - while (null != line.getNext()) { - recordViolation(resource, line); - } - } - - private void recordViolation(final org.sonar.api.resources.File resource, - final SMInputCursor line) throws XMLStreamException { - final Rule rule = Rule.create(); - final Violation violation = Violation.create(rule, resource); - - // PMD Priorities are 1, 2, 3, 4, 5 RulePriority[0] is INFO - rule.setSeverity(RulePriority.values()[PMD_MINIMUM_PRIORITY - - Integer.valueOf(line.getAttrValue("priority"))]); - rule.setKey(line.getAttrValue("rule")); - rule.setRepositoryKey(OCLintRuleRepository.REPOSITORY_KEY); - - violation.setLineId(Integer.valueOf(line.getAttrValue("beginline"))); - - violation.setMessage(line.getElemStringValue()); - - foundViolations.add(violation); - } - - private boolean fileExists(final org.sonar.api.resources.File file) { - return context.getResource(file) != null; - } - -} diff --git a/src/main/resources/com/sonar/sqale/objectivec-model.xml b/src/main/resources/com/sonar/sqale/oclint-model.xml similarity index 100% rename from src/main/resources/com/sonar/sqale/objectivec-model.xml rename to src/main/resources/com/sonar/sqale/oclint-model.xml diff --git a/src/main/resources/org/sonar/plugins/objectivec/profile-oclint.xml b/src/main/resources/org/sonar/plugins/objectivec/profile-oclint.xml new file mode 100644 index 00000000..7e97b037 --- /dev/null +++ b/src/main/resources/org/sonar/plugins/objectivec/profile-oclint.xml @@ -0,0 +1,258 @@ + + OCLint + objc + + + OCLint + bitwise operator in conditional + + + OCLint + broken nil check + + + OCLint + broken null check + + + OCLint + broken oddness check + + + OCLint + collapsible if statements + + + OCLint + constant conditional operator + + + OCLint + constant if expression + + + OCLint + dead code + + + OCLint + double negative + + + OCLint + for loop should be while loop + + + OCLint + goto statement + + + OCLint + misplaced nil check + + + OCLint + misplaced null check + + + OCLint + multiple unary operator + + + OCLint + return from finally block + + + OCLint + throw exception from finally block + + + OCLint + avoid branching statement as last in loop + + + OCLint + default label not last in switch statement + + + OCLint + inverted logic + + + OCLint + non case label in switch statement + + + OCLint + parameter reassignment + + + OCLint + switch statements should have default + + + OCLint + too few branches in switch statement + + + OCLint + empty catch statement + + + OCLint + empty do/while statement + + + OCLint + empty else block + + + OCLint + empty finally statement + + + OCLint + empty for statement + + + OCLint + empty if statement + + + OCLint + empty switch statement + + + OCLint + empty try statement + + + OCLint + empty while statement + + + OCLint + replace with boxed expression + + + OCLint + replace with container literal + + + OCLint + replace with number literal + + + OCLint + replace with object subscripting + + + OCLint + long variable name + + + OCLint + short variable name + + + OCLint + redundant conditional operator + + + OCLint + redundant if statement + + + OCLint + redundant local variable + + + OCLint + redundant nil check + + + OCLint + unnecessary else statement + + + OCLint + useless parentheses + + + OCLint + high cyclomatic complexity + + + OCLint + long class + + + OCLint + long line + + + OCLint + long method + + + OCLint + high ncss method + + + OCLint + deep nested block + + + OCLint + high npath complexity + + + OCLint + too many fields + + + OCLint + too many methods + + + OCLint + too many parameters + + + OCLint + unused local variable + + + OCLint + unused method parameter + + + OCLint + feature envy + + + OCLint + ivar assignment outside accessors or init + + + OCLint + jumbled incrementer + + + OCLint + missing break in switch statement + + + OCLint + must override hash with isEqual + + + OCLint + switch statements don't need default when fully covered + + + OCLint + use early exits and continue + + + \ No newline at end of file diff --git a/src/main/resources/org/sonar/plugins/objectivec/rules-clang.xml b/src/main/resources/org/sonar/plugins/objectivec/rules-clang.xml index 180b22a1..5b52905a 100644 --- a/src/main/resources/org/sonar/plugins/objectivec/rules-clang.xml +++ b/src/main/resources/org/sonar/plugins/objectivec/rules-clang.xml @@ -1,7 +1,6 @@ other - other Clang Static Analyzer warning - other MAJOR Warning reported by Clang Static Analyzer (uncategorized). diff --git a/src/main/resources/org/sonar/plugins/objectivec/rules-oclint.xml b/src/main/resources/org/sonar/plugins/objectivec/rules-oclint.xml new file mode 100644 index 00000000..90a612ef --- /dev/null +++ b/src/main/resources/org/sonar/plugins/objectivec/rules-oclint.xml @@ -0,0 +1,380 @@ + + + bitwise operator in conditional + Bitwise operator in conditional + CRITICAL + Checks for bitwise operations in conditionals. Although being written on purpose in some rare cases, bitwise operations are considered to be too “smart”. Smart code is not easy to understand. + + + broken nil check + Broken nil check + CRITICAL + The broken nil check in Objective-C in some cases returns just the opposite result. + + + broken null check + Broken null check + CRITICAL + The broken null check itself will crash the program. + + + broken oddness check + Broken oddness check + CRITICAL + Checking oddness by x%2==1 won’t work for negative numbers. Use x&1==1, or x%2!=0 instead. + + + collapsible if statements + Collapsible if statements + CRITICAL + This rule detects instances where the conditions of two consecutive if statements can combined into one in order to increase code cleanness and readability. + + + constant conditional operator + Constant conditional operator + CRITICAL + conditionaloperator whose conditionals are always true or always false are confusing. + + + constant if expression + Constant if expression + CRITICAL + if statements whose conditionals are always true or always false are confusing. + + + dead code + Dead code + CRITICAL + Code after return, break, continue, and throw statements are unreachable and will never be executed. + + + double negative + Double negative + CRITICAL + There is no point in using a double negative, it is always positive. + + + for loop should be while loop + For loop should be while loop + CRITICAL + Under certain circumstances, some for loops can be simplified to while loops to make code more concise. + + + goto statement + Goto statement + CRITICAL + “Go To Statement Considered Harmful” + + + misplaced nil check + Misplaced nil check + CRITICAL + The nil check is misplaced. In Objective-C, sending a message to a nil pointer simply does nothing. But code readers may be confused about the misplaced nil check. + + + misplaced null check + Misplaced null check + CRITICAL + The null check is misplaced. In C and C++, sending a message to a null pointer could crash the app. When null is misplaced, either the check is useless or it’s incorrect. + + + multiple unary operator + Multiple unary operator + CRITICAL + Multiple unary operator can always be confusing and should be simplified. + + + return from finally block + Return from finally block + CRITICAL + Returning from a finally block is not recommended. + + + throw exception from finally block + Throw exception from finally block + CRITICAL + Throwing exceptions within a finally block may mask other exceptions or code defects. + + + avoid branching statement as last in loop + Avoid branching statement as last in loop + MAJOR + Having branching statement as the last statement inside a loop is very confusing, and could largely be forgetting of something and turning into a bug. + + + default label not last in switch statement + Default label not last in switch statement + MAJOR + It is very confusing when default label is not the last label in a switch statement. + + + inverted logic + Inverted logic + MAJOR + An inverted logic is hard to understand. + + + non case label in switch statement + Non case label in switch statement + MAJOR + It is very confusing when default label is not the last label in a switch statement. + + + parameter reassignment + Parameter reassignment + MAJOR + Reassigning values to parameters is very problematic in most cases. + + + switch statements should have default + Switch statements should have default + MAJOR + Switch statements should a default statement. + + + too few branches in switch statement + Too few branches in switch statement + MAJOR + To increase code readability, when a switch consists of only a few branches, it’s much better to use if statement. + + + empty catch statement + Empty catch statement + CRITICAL + This rule detects instances where an exception is caught, but nothing is done about it. + + + empty do/while statement + Empty do while statement + CRITICAL + This rule detects instances where a do-while statement does nothing. + + + empty else block + Empty else block + CRITICAL + This rule detects instances where a else statement does nothing. + + + empty finally statement + Empty finally statement + CRITICAL + This rule detects instances where a finally statement does nothing. + + + empty for statement + Empty for statement + CRITICAL + This rule detects instances where a for statement does nothing. + + + empty if statement + Empty if statement + CRITICAL + This rule detects instances where a condition is checked, but nothing is done about it. + + + empty switch statement + Empty switch statement + CRITICAL + This rule detects instances where a switch statement does nothing. + + + empty try statement + Empty try statement + CRITICAL + This rule detects instances where a try statement is empty. + + + empty while statement + Empty while statement + CRITICAL + This rule detects instances where a while statement does nothing. + + + replace with boxed expression + Obj c boxed expressions + MINOR + This rule locates the places that can be migrated to the new Objective-C literals with boxed expressions. + + + replace with container literal + Obj c container literals + MINOR + This rule locates the places that can be migrated to the new Objective-C literals with container literals. + + + replace with number literal + Obj cns number literals + MINOR + This rule locates the places that can be migrated to the new Objective-C literals with number literals. + + + replace with object subscripting + Obj c object subscripting + MINOR + This rule locates the places that can be migrated to the new Objective-C literals with object subscripting. + + + long variable name + Long variable name + MAJOR + Variables with long names harm readability. + + + short variable name + Short variable name + MAJOR + Variable with a short name is hard to understand what it stands for. Variable with name, but the name has number of characters less than the threshold will be emitted. + + + redundant conditional operator + Redundant conditional operator + MINOR + This rule detects three types of redundant conditional operators: + + + redundant if statement + Redundant if statement + MINOR + This rule detects unnecessary if statements. + + + redundant local variable + Redundant local variable + MINOR + This rule detects cases where a variable declaration immediately followed by a return of that variable. + + + redundant nil check + Redundant nil check + MINOR + C/C++-style null check in Objective-C like foo!=nil&&[foobar] is redundant, since sending a message to a nil object in this case simply return a false-y value. + + + unnecessary else statement + Unnecessary else statement + MINOR + When an if statement block ends with a return statement, or all branches in the if statement block end with return statements, then the else statement is unnecessary. The code in the else statement can be run without being in the block. + + + useless parentheses + Useless parentheses + MINOR + This rule detects useless parentheses. + + + high cyclomatic complexity + Cyclomatic complexity + CRITICAL + Cyclomatic complexity is determined by the number of linearly independent paths through a program’s source code. In other words, cyclomatic complexity of a method is measured by the number of decision points, like if, while, and for statements, plus one for the method entry. + + + long class + Long class + MAJOR + Long class generally indicates that this class tries to so many things. Each class should do one thing and one thing well. + + + long line + Long line + MINOR + When number of characters for one line of code is very long, it largely harm the readability. Break long line of code into multiple lines. + + + long method + Long method + MAJOR + Long method generally indicates that this method tries to so many things. Each method should do one thing and one thing well. + + + high ncss method + Ncss method count + CRITICAL + This rule counts number of lines for a method by counting Non Commenting Source Statements (NCSS). NCSS only takes actual statements into consideration, in other words, ignores empty statements, empty blocks, closing brackets or semicolons after closing brackets. Meanwhile, statement that is break into multiple lines contribute only one count. + + + deep nested block + Nested block depth + CRITICAL + This rule indicates blocks nested more deeply than the upper limit. + + + high npath complexity + N path complexity + CRITICAL + NPath complexity is determined by the number of execution paths through that method. Compared to cyclomatic complexity, NPath complexity has two outstanding characteristics: first, it distinguish between different kinds of control flow structures; second, it takes the various type of acyclic paths in a flow graph into consideration. + + + too many fields + Too many fields + CRITICAL + A class with too many fields indicates it does too many things and is lack of proper abstraction. It can be resigned to have fewer fields. + + + too many methods + Too many methods + CRITICAL + A class with too many methods indicates it does too many things and hard to read and understand. It usually contains complicated code, and should be refactored. + + + too many parameters + Too many parameters + CRITICAL + Methods with too many parameters are hard to understand and maintain, and are thirsty for refactorings, like Replace Parameter With method, Introduce Parameter Object, or Preserve Whole Object. + + + unused local variable + Unused local variable + INFO + This rule detects local variables that are declared, but not used. + + + unused method parameter + Unused method parameter + INFO + This rule detects parameters that are not used in the method. + + + feature envy + Feature envy + CRITICAL + Feature envy + + + ivar assignment outside accessors or init + Ivar assignment outside accessors or init + MAJOR + Ivar assignment outside accessors or init + + + jumbled incrementer + Jumbled incrementer + MAJOR + Jumbled incrementer + + + missing break in switch statement + Missing break in switch statement + MAJOR + Missing break in switch statement + + + must override hash with isEqual + Must override hash with isEqual + MINOR + Must override hash with isEqual + + + switch statements don't need default when fully covered + Switch statements don't need default when fully covered + MAJOR + Switch statements don't need default when fully covered + + + use early exits and continue + Use early exits and continue + MAJOR + Use early exits and continue + + diff --git a/src/main/resources/org/sonar/plugins/oclint/profile-oclint.xml b/src/main/resources/org/sonar/plugins/oclint/profile-oclint.xml deleted file mode 100644 index 35fa35d4..00000000 --- a/src/main/resources/org/sonar/plugins/oclint/profile-oclint.xml +++ /dev/null @@ -1,259 +0,0 @@ - - - OCLint - objc - - - OCLint - use early exits and continue - - - OCLint - avoid branching statement as last in loop - - - OCLint - bitwise operator in conditional - - - OCLint - broken null check - - - OCLint - broken nil check - - - OCLint - broken oddness check - - - OCLint - collapsible if statements - - - OCLint - constant conditional operator - - - OCLint - constant if expression - - - OCLint - high cyclomatic complexity - - - OCLint - dead code - - - OCLint - default label not last in switch statement - - - OCLint - double negative - - - OCLint - empty catch statement - - - OCLint - empty do/while statement - - - OCLint - empty else block - - - OCLint - empty finally statement - - - OCLint - empty for statement - - - OCLint - empty if statement - - - OCLint - empty switch statement - - - OCLint - empty try statement - - - OCLint - empty while statement - - - OCLint - feature envy - - - OCLint - for loop should be while loop - - - OCLint - goto statement - - - OCLint - inverted logic - - - OCLint - jumbled incrementer - - - OCLint - long class - - - OCLint - long line - - - OCLint - long method - - - OCLint - long variable name - - - OCLint - misplaced null check - - - OCLint - misplaced nil check - - - OCLint - missing break in switch statement - - - OCLint - multiple unary operator - - - OCLint - must override hash with isEqual - - - OCLint - high ncss method - - - OCLint - deep nested block - - - OCLint - non case label in switch statement - - - OCLint - high npath complexity - - - OCLint - replace with boxed expression - - - OCLint - replace with container literal - - - OCLint - replace with number literal - - - OCLint - replace with object subscripting - - - OCLint - parameter reassignment - - - OCLint - redundant conditional operator - - - OCLint - redundant if statement - - - OCLint - redundant local variable - - - OCLint - redundant nil check - - - OCLint - return from finally block - - - OCLint - short variable name - - - OCLint - switch statements don't need default when fully covered - - - OCLint - switch statements should have default - - - OCLint - throw exception from finally block - - - OCLint - too few branches in switch statement - - - OCLint - too many fields - - - OCLint - too many methods - - - OCLint - too many parameters - - - OCLint - unnecessary else statement - - - OCLint - unused local variable - - - OCLint - unused method parameter - - - OCLint - useless parentheses - - - OCLint - ivar assignment outside accessors or init - - - \ No newline at end of file diff --git a/src/main/resources/org/sonar/plugins/oclint/rules.txt b/src/main/resources/org/sonar/plugins/oclint/rules.txt deleted file mode 100644 index beb11d6b..00000000 --- a/src/main/resources/org/sonar/plugins/oclint/rules.txt +++ /dev/null @@ -1,509 +0,0 @@ -Available issues: - -OCLint -====== - -use early exits and continue ----------- - -Summary: - -Severity: 2 -Category: OCLint - -avoid branching statement as last in loop ----------- - -Summary: Having branching statement as the last statement inside a loop is very confusing, and could largely be forgetting of something and turning into a bug. - -Severity: 2 -Category: OCLint - -bitwise operator in conditional ----------- - -Summary: Checks for bitwise operations in conditionals. Although being written on purpose in some rare cases, bitwise operations are considered to be too “smart”. Smart code is not easy to understand. - -Severity: 3 -Category: OCLint - -broken null check ----------- - -Summary: The broken nil check in Objective-C in some cases returns just the opposite result. - -Severity: 4 -Category: OCLint - -broken nil check ----------- - -Summary: - -Severity: 4 -Category: OCLint - -broken oddness check ----------- - -Summary: Checking oddness by x%2==1 won’t work for negative numbers. Use x&1==1, or x%2!=0 instead. - -Severity: 3 -Category: OCLint - -collapsible if statements ----------- - -Summary: This rule detects instances where the conditions of two consecutive if statements can combined into one in order to increase code cleanness and readability. - -Severity: 3 -Category: OCLint - -constant conditional operator ----------- - -Summary: conditionaloperator whose conditionals are always true or always false are confusing. - -Severity: 3 -Category: OCLint - -constant if expression ----------- - -Summary: if statements whose conditionals are always true or always false are confusing. - -Severity: 3 -Category: OCLint - -high cyclomatic complexity ----------- - -Summary: - -Severity: 2 -Category: OCLint - -dead code ----------- - -Summary: Code after return, break, continue, and throw statements are unreachable and will never be executed. - -Severity: 3 -Category: OCLint - -default label not last in switch statement ----------- - -Summary: It is very confusing when default label is not the last label in a switch statement. - -Severity: 2 -Category: OCLint - -double negative ----------- - -Summary: There is no point in using a double negative, it is always positive. - -Severity: 3 -Category: OCLint - -empty catch statement ----------- - -Summary: This rule detects instances where an exception is caught, but nothing is done about it. - -Severity: 3 -Category: OCLint - -empty do/while statement ----------- - -Summary: This rule detects instances where a do-while statement does nothing. - -Severity: 3 -Category: OCLint - -empty else block ----------- - -Summary: - -Severity: 2 -Category: OCLint - -empty finally statement ----------- - -Summary: This rule detects instances where a finally statement does nothing. - -Severity: 3 -Category: OCLint - -empty for statement ----------- - -Summary: This rule detects instances where a for statement does nothing. - -Severity: 3 -Category: OCLint - -empty if statement ----------- - -Summary: This rule detects instances where a condition is checked, but nothing is done about it. - -Severity: 3 -Category: OCLint - -empty switch statement ----------- - -Summary: This rule detects instances where a switch statement does nothing. - -Severity: 3 -Category: OCLint - -empty try statement ----------- - -Summary: This rule detects instances where a try statement is empty. - -Severity: 3 -Category: OCLint - -empty while statement ----------- - -Summary: - -Severity: 3 -Category: OCLint - -feature envy ----------- - -Summary: - -Severity: 3 -Category: OCLint - -for loop should be while loop ----------- - -Summary: Under certain circumstances, some for loops can be simplified to while loops to make code more concise. - -Severity: 3 -Category: OCLint - -goto statement ----------- - -Summary: - -Severity: 3 -Category: OCLint - -inverted logic ----------- - -Summary: An inverted logic is hard to understand. - -Severity: 2 -Category: OCLint - -jumbled incrementer ----------- - -Summary: - -Severity: 2 -Category: OCLint - -long class ----------- - -Summary: Long class generally indicates that this class tries to so many things. Each class should do one thing and one thing well. - -Severity: 3 -Category: OCLint - -long line ----------- - -Summary: When number of characters for one line of code is very long, it largely harm the readability. Break long line of code into multiple lines. - -Severity: 2 -Category: OCLint - -long method ----------- - -Summary: Long method generally indicates that this method tries to so many things. Each method should do one thing and one thing well. - -Severity: 3 -Category: OCLint - -long variable name ----------- - -Summary: Variables with long names harm readability. - -Severity: 2 -Category: OCLint - -misplaced null check ----------- - -Summary: The nil check is misplaced. In Objective-C, sending a message to a nil pointer simply does nothing. But code readers may be confused about the misplaced nil check. - -Severity: 3 -Category: OCLint - -misplaced nil check ----------- - -Summary: - -Severity: 4 -Category: OCLint - -missing break in switch statement ----------- - -Summary: - -Severity: 2 -Category: OCLint - -multiple unary operator ----------- - -Summary: Multiple unary operator can always be confusing and should be simplified. - -Severity: 3 -Category: OCLint - -must override hash with isEqual ----------- - -Summary: - -Severity: 1 -Category: OCLint - -high ncss method ----------- - -Summary: This rule counts number of lines for a method by counting Non Commenting Source Statements (NCSS). NCSS only takes actual statements into consideration, in other words, ignores empty statements, empty blocks, closing brackets or semicolons after closing brackets. Meanwhile, statement that is break into multiple lines contribute only one count. - -Severity: 3 -Category: OCLint - -deep nested block ----------- - -Summary: This rule indicates blocks nested more deeply than the upper limit. - -Severity: 3 -Category: OCLint - -non case label in switch statement ----------- - -Summary: It is very confusing when default label is not the last label in a switch statement. - -Severity: 2 -Category: OCLint - -high npath complexity ----------- - -Summary: - -Severity: 2 -Category: OCLint - -replace with boxed expression ----------- - -Summary: This rule locates the places that can be migrated to the new Objective-C literals with boxed expressions. - -Severity: 1 -Category: OCLint - -replace with container literal ----------- - -Summary: This rule locates the places that can be migrated to the new Objective-C literals with container literals. - -Severity: 1 -Category: OCLint - -replace with number literal ----------- - -Summary: This rule locates the places that can be migrated to the new Objective-C literals with number literals. - -Severity: 1 -Category: OCLint - -replace with object subscripting ----------- - -Summary: - -Severity: 1 -Category: OCLint - -parameter reassignment ----------- - -Summary: Reassigning values to parameters is very problematic in most cases. - -Severity: 2 -Category: OCLint - -redundant conditional operator ----------- - -Summary: This rule detects three types of redundant conditional operators: - -Severity: 1 -Category: OCLint - -redundant if statement ----------- - -Summary: This rule detects unnecessary if statements. - -Severity: 1 -Category: OCLint - -redundant local variable ----------- - -Summary: This rule detects cases where a variable declaration immediately followed by a return of that variable. - -Severity: 1 -Category: OCLint - -redundant nil check ----------- - -Summary: - -Severity: 3 -Category: OCLint - -return from finally block ----------- - -Summary: Returning from a finally block is not recommended. - -Severity: 3 -Category: OCLint - -short variable name ----------- - -Summary: - -Severity: 2 -Category: OCLint - -switch statements don't need default when fully covered ----------- - -Summary: - -Severity: 3 -Category: OCLint - -switch statements should have default ----------- - -Summary: Switch statements should a default statement. - -Severity: 2 -Category: OCLint - -throw exception from finally block ----------- - -Summary: - -Severity: 3 -Category: OCLint - -too few branches in switch statement ----------- - -Summary: - -Severity: 2 -Category: OCLint - -too many fields ----------- - -Summary: A class with too many fields indicates it does too many things and is lack of proper abstraction. It can be resigned to have fewer fields. - -Severity: 3 -Category: OCLint - -too many methods ----------- - -Summary: A class with too many methods indicates it does too many things and hard to read and understand. It usually contains complicated code, and should be refactored. - -Severity: 3 -Category: OCLint - -too many parameters ----------- - -Summary: - -Severity: 3 -Category: OCLint - -unnecessary else statement ----------- - -Summary: When an if statement block ends with a return statement, or all branches in the if statement block end with return statements, then the else statement is unnecessary. The code in the else statement can be run without being in the block. - -Severity: 1 -Category: OCLint - -unused local variable ----------- - -Summary: This rule detects local variables that are declared, but not used. - -Severity: 0 -Category: OCLint - -unused method parameter ----------- - -Summary: - -Severity: 0 -Category: OCLint - -useless parentheses ----------- - -Summary: - -Severity: 1 -Category: OCLint - -ivar assignment outside accessors or init ----------- - -Summary: - -Severity: 2 -Category: OCLint - diff --git a/src/test/java/org/sonar/plugins/objectivec/complexity/LizardReportParserTest.java b/src/test/java/org/sonar/plugins/objectivec/complexity/LizardReportParserTest.java index 43bc8518..41b91e4f 100644 --- a/src/test/java/org/sonar/plugins/objectivec/complexity/LizardReportParserTest.java +++ b/src/test/java/org/sonar/plugins/objectivec/complexity/LizardReportParserTest.java @@ -141,11 +141,9 @@ public File createIncorrectFile() throws IOException { */ @Test public void parseReportShouldReturnMapWhenXMLFileIsCorrect() { - LizardReportParser parser = new LizardReportParser(); - assertNotNull("correct file is null", correctFile); - Map> report = parser.parseReport(correctFile); + Map> report = LizardReportParser.parseReport(correctFile); assertNotNull("report is null", report); @@ -195,11 +193,9 @@ public void parseReportShouldReturnMapWhenXMLFileIsCorrect() { */ @Test public void parseReportShouldReturnNullWhenXMLFileIsIncorrect() { - LizardReportParser parser = new LizardReportParser(); - assertNotNull("correct file is null", incorrectFile); - Map> report = parser.parseReport(incorrectFile); + Map> report = LizardReportParser.parseReport(incorrectFile); assertNull("report is not null", report); } diff --git a/src/test/java/org/sonar/plugins/objectivec/complexity/LizardSensorTest.java b/src/test/java/org/sonar/plugins/objectivec/complexity/LizardSensorTest.java deleted file mode 100644 index 55748d17..00000000 --- a/src/test/java/org/sonar/plugins/objectivec/complexity/LizardSensorTest.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology - * dev@sonar.codehaus.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ - -package org.sonar.plugins.objectivec.complexity; - -import org.junit.Before; -import org.junit.Test; -import org.sonar.api.batch.fs.FileSystem; -import org.sonar.api.config.Settings; -import org.sonar.api.resources.Project; -import org.sonar.plugins.objectivec.core.ObjectiveC; - -import java.util.SortedSet; -import java.util.TreeSet; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -/** - * @author Andres Gil Herrera - * @since 03/06/15. - */ -public class LizardSensorTest { - - private Settings settings; - - @Before - public void setUp() { - settings = new Settings(); - } - - /** - * this method tests that the sensor should be executed when a project is a root project and uses objective c - */ - @Test - public void shouldExecuteOnProjectShouldBeTrueWhenProjectIsObjc() { - final Project project = new Project("Test"); - - FileSystem fileSystem = mock(FileSystem.class); - SortedSet languages = new TreeSet(); - languages.add(ObjectiveC.KEY); - when(fileSystem.languages()).thenReturn(languages); - - final LizardSensor testedSensor = new LizardSensor(fileSystem, settings); - - assertTrue(testedSensor.shouldExecuteOnProject(project)); - } - - /** - * this method tests that the sensor does not get executed when a project dont uses objective c - */ - @Test - public void shouldExecuteOnProjectShouldBeFalseWhenProjectIsSomethingElse() { - final Project project = new Project("Test"); - - FileSystem fileSystem = mock(FileSystem.class); - SortedSet languages = new TreeSet(); - languages.add("Test"); - when(fileSystem.languages()).thenReturn(languages); - - final LizardSensor testedSensor = new LizardSensor(fileSystem, settings); - - assertFalse(testedSensor.shouldExecuteOnProject(project)); - } - -} diff --git a/src/test/java/org/sonar/plugins/objectivec/coverage/CoberturaMeasuresPersistorTest.java b/src/test/java/org/sonar/plugins/objectivec/coverage/CoberturaMeasuresPersistorTest.java deleted file mode 100644 index 8ac0339b..00000000 --- a/src/test/java/org/sonar/plugins/objectivec/coverage/CoberturaMeasuresPersistorTest.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology - * dev@sonar.codehaus.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.objectivec.coverage; - -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.never; -import static org.mockito.Mockito.times; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.junit.Test; -import org.sonar.api.batch.SensorContext; -import org.sonar.api.measures.CoverageMeasuresBuilder; -import org.sonar.api.measures.Measure; -import org.sonar.api.resources.Project; -import org.sonar.api.resources.ProjectFileSystem; -import org.sonar.api.resources.Resource; - -public final class CoberturaMeasuresPersistorTest { - - @Test - public void shouldNotPersistMeasuresForUnknownFiles() { - final Project project = new Project("Test"); - - final SensorContext context = mock(SensorContext.class); - final ProjectFileSystem fileSystem = mock(ProjectFileSystem.class); - final Map measures = new HashMap(); - measures.put("DummyResource", CoverageMeasuresBuilder.create()); - - - when(fileSystem.getBasedir()).thenReturn(new File(".")); - - project.setFileSystem(fileSystem); - - final CoverageMeasuresPersistor testedPersistor = new CoverageMeasuresPersistor(project, context); - testedPersistor.saveMeasures(measures); - - verify(context, never()).saveMeasure(any(Resource.class), any(Measure.class)); - } - - @Test - public void shouldPersistMeasuresForKnownFiles() { - final Project project = new Project("Test"); - final org.sonar.api.resources.File dummyFile = new org.sonar.api.resources.File("dummy/test"); - final SensorContext context = mock(SensorContext.class); - final ProjectFileSystem fileSystem = mock(ProjectFileSystem.class); - final List sourceDirs = new ArrayList(); - final Map measures = new HashMap(); - final CoverageMeasuresBuilder measureBuilder = CoverageMeasuresBuilder.create(); - - sourceDirs.add(new File("/dummy")); - measures.put("/dummy/test", measureBuilder); - measureBuilder.setHits(99, 99); - measureBuilder.setConditions(99, 99, 1); - - when(fileSystem.getSourceDirs()).thenReturn(sourceDirs); - when(context.getResource(any(Resource.class))).thenReturn(dummyFile); - when(fileSystem.getBasedir()).thenReturn(new File(".")); - - project.setFileSystem(fileSystem); - - final CoverageMeasuresPersistor testedPersistor = new CoverageMeasuresPersistor(project, context); - testedPersistor.saveMeasures(measures); - - for (final Measure measure : measureBuilder.createMeasures()) { - verify(context, times(1)).saveMeasure(eq(org.sonar.api.resources.File.fromIOFile(new File(project.getFileSystem().getBasedir(), "dummy/test"), project)), eq(measure)); - } - } - -} diff --git a/src/test/java/org/sonar/plugins/objectivec/coverage/CoberturaParserTest.java b/src/test/java/org/sonar/plugins/objectivec/coverage/CoberturaParserTest.java deleted file mode 100644 index f3d6be1e..00000000 --- a/src/test/java/org/sonar/plugins/objectivec/coverage/CoberturaParserTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology - * dev@sonar.codehaus.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.objectivec.coverage; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.io.File; -import java.util.Map; - -import org.apache.tools.ant.filters.StringInputStream; -import org.junit.Test; -import org.sonar.api.measures.CoverageMeasuresBuilder; - -public final class CoberturaParserTest { - private final String VALID_REPORT_FILE_PATH = "FILEPATH"; - private final String VALID_REPORT = "."; - - @Test - public void parseReportShouldReturnAnEmptyMapWhenTheReportIsInvalid() { - final CoberturaParser coberturaParser = new CoberturaParser(); - final Map measures = coberturaParser.parseReport(new StringInputStream("")); - - assertTrue(measures.isEmpty()); - } - - @Test - public void parseReportShouldReturnAnEmptyMapWhenTheFileIsInvalid() { - final CoberturaParser coberturaParser = new CoberturaParser(); - final Map measures = coberturaParser.parseReport(new File("")); - - assertTrue(measures.isEmpty()); - } - - @Test - public void parseReportShouldReturnAMapOfFileToMeasuresWhenTheReportIsValid() { - final CoberturaParser coberturaParser = new CoberturaParser(); - final Map measures = coberturaParser.parseReport(new StringInputStream(VALID_REPORT)); - - assertNotNull(measures.get(VALID_REPORT_FILE_PATH)); - } - -} diff --git a/src/test/java/org/sonar/plugins/objectivec/coverage/CoberturaSensorTest.java b/src/test/java/org/sonar/plugins/objectivec/coverage/CoberturaSensorTest.java deleted file mode 100644 index 84922956..00000000 --- a/src/test/java/org/sonar/plugins/objectivec/coverage/CoberturaSensorTest.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology - * dev@sonar.codehaus.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.objectivec.coverage; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import org.junit.Before; -import org.junit.Test; -import org.sonar.api.batch.fs.FileSystem; -import org.sonar.api.config.Settings; -import org.sonar.api.resources.Project; -import org.sonar.api.scan.filesystem.ModuleFileSystem; -import org.sonar.plugins.objectivec.core.ObjectiveC; - -import java.util.SortedSet; -import java.util.TreeSet; - -public final class CoberturaSensorTest { - - private Settings settings; - - @Before - public void setUp() { - settings = new Settings(); - } - - @Test - public void shouldExecuteOnProjectShouldBeTrueWhenProjectIsObjc() { - final Project project = new Project("Test"); - - FileSystem fileSystem = mock(FileSystem.class); - SortedSet languages = new TreeSet(); - languages.add(ObjectiveC.KEY); - when(fileSystem.languages()).thenReturn(languages); - - final CoberturaSensor testedSensor = new CoberturaSensor(fileSystem, settings); - - assertTrue(testedSensor.shouldExecuteOnProject(project)); - } - - @Test - public void shouldExecuteOnProjectShouldBeFalseWhenProjectIsSomethingElse() { - final Project project = new Project("Test"); - settings.setProperty("sonar.language", "Test"); - - FileSystem fileSystem = mock(FileSystem.class); - SortedSet languages = new TreeSet(); - languages.add("Test"); - when(fileSystem.languages()).thenReturn(languages); - - final CoberturaSensor testedSensor = new CoberturaSensor(fileSystem, settings); - - assertFalse(testedSensor.shouldExecuteOnProject(project)); - } - -} diff --git a/src/test/java/org/sonar/plugins/objectivec/coverage/CoberturaXMLStreamHandlerTest.java b/src/test/java/org/sonar/plugins/objectivec/coverage/CoberturaXMLStreamHandlerTest.java deleted file mode 100644 index 1b9f3e6a..00000000 --- a/src/test/java/org/sonar/plugins/objectivec/coverage/CoberturaXMLStreamHandlerTest.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology - * dev@sonar.codehaus.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.objectivec.coverage; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.stream.XMLStreamException; - -import org.apache.tools.ant.filters.StringInputStream; -import org.junit.Test; -import org.sonar.api.measures.CoverageMeasuresBuilder; -import org.sonar.api.utils.StaxParser; - -public final class CoberturaXMLStreamHandlerTest { - private final String EMPTY_REPORT = "."; - private final String VALID_REPORT = "."; - private final String FILE_PATH = "FILEPATH"; - private final int NO_HIT_LINE = 25; - private final int NO_BRANCH_LINE = 29; - private final int BRANCH_LINE = 35; - - @Test - public void streamLeavesTheMapEmptyWhenNoLinesAreFound() throws XMLStreamException { - final Map parseResults = new HashMap(); - final StaxParser parser = new StaxParser(new CoberturaXMLStreamHandler(parseResults)); - - parser.parse(new StringInputStream(EMPTY_REPORT)); - - assertTrue(parseResults.isEmpty()); - } - - @Test - public void streamAddsACoverageMeasureBuilderForClassesInTheReport() throws XMLStreamException { - final Map parseResults = new HashMap(); - final StaxParser parser = new StaxParser(new CoberturaXMLStreamHandler(parseResults)); - - parser.parse(new StringInputStream(VALID_REPORT)); - - assertNotNull(parseResults.get(FILE_PATH)); - } - - @Test - public void streamRecords0HitsForLinesWithNoHits() throws XMLStreamException { - final Map parseResults = new HashMap(); - final StaxParser parser = new StaxParser(new CoberturaXMLStreamHandler(parseResults)); - - parser.parse(new StringInputStream(VALID_REPORT)); - - assertEquals(Integer.valueOf(0), parseResults.get(FILE_PATH).getHitsByLine().get(NO_HIT_LINE)); - } - - @Test - public void streamRecordsHitsForLinesWithNoBranch() throws XMLStreamException { - final Map parseResults = new HashMap(); - final StaxParser parser = new StaxParser(new CoberturaXMLStreamHandler(parseResults)); - - parser.parse(new StringInputStream(VALID_REPORT)); - - assertEquals(Integer.valueOf(1), parseResults.get(FILE_PATH).getHitsByLine().get(NO_BRANCH_LINE)); - } - - @Test - public void streamRecordsHitsForLinesWithBranch() throws XMLStreamException { - final Map parseResults = new HashMap(); - final StaxParser parser = new StaxParser(new CoberturaXMLStreamHandler(parseResults)); - - parser.parse(new StringInputStream(VALID_REPORT)); - - assertEquals(Integer.valueOf(10), parseResults.get(FILE_PATH).getHitsByLine().get(BRANCH_LINE)); - } - - @Test - public void streamRecordsConditionsForLinesWithBranch() throws XMLStreamException { - final Map parseResults = new HashMap(); - final StaxParser parser = new StaxParser(new CoberturaXMLStreamHandler(parseResults)); - - parser.parse(new StringInputStream(VALID_REPORT)); - - assertEquals(Integer.valueOf(2), parseResults.get(FILE_PATH).getConditionsByLine().get(BRANCH_LINE)); - } - - @Test - public void streamRecordsConditionsHitsForLinesWithBranch() throws XMLStreamException { - final Map parseResults = new HashMap(); - final StaxParser parser = new StaxParser(new CoberturaXMLStreamHandler(parseResults)); - - parser.parse(new StringInputStream(VALID_REPORT)); - - assertEquals(Integer.valueOf(1), parseResults.get(FILE_PATH).getCoveredConditionsByLine().get(BRANCH_LINE)); - } - -} diff --git a/src/test/java/org/sonar/plugins/objectivec/violations/OCLintParserTest.java b/src/test/java/org/sonar/plugins/objectivec/violations/OCLintParserTest.java deleted file mode 100644 index 12730013..00000000 --- a/src/test/java/org/sonar/plugins/objectivec/violations/OCLintParserTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology - * dev@sonar.codehaus.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.objectivec.violations; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.apache.tools.ant.filters.StringInputStream; -import org.junit.Test; -import org.sonar.api.batch.SensorContext; -import org.sonar.api.resources.Project; -import org.sonar.api.resources.ProjectFileSystem; -import org.sonar.api.resources.Resource; -import org.sonar.api.rules.Violation; - -public class OCLintParserTest { - private final String VALID_REPORT = "An operation on an Immutable object (String, BigDecimal or BigInteger) won't change the object itself"; - - @Test - public void parseReportShouldReturnAnEmptyCollectionWhenTheReportIsInvalid() { - final OCLintParser testedParser = new OCLintParser(null, null); - final Collection violations = testedParser.parseReport(new StringInputStream("")); - - assertTrue(violations.isEmpty()); - } - - @Test - public void parseReportShouldReturnAnEmptyMapWhenTheFileIsInvalid() { - final OCLintParser testedParser = new OCLintParser(null, null); - final Collection violations = testedParser.parseReport(new File("")); - - assertTrue(violations.isEmpty()); - } - - @Test - public void parseReportShouldReturnACollectionOfViolationsWhenTheReportIsNotEmpty() { - final Project project = new Project("Test"); - final org.sonar.api.resources.File dummyFile = new org.sonar.api.resources.File("dummy/test"); - final SensorContext context = mock(SensorContext.class); - final ProjectFileSystem fileSystem = mock(ProjectFileSystem.class); - final List sourceDirs = new ArrayList(); - - final OCLintParser testedParser = new OCLintParser(project, context); - - sourceDirs.add(new File("/dummy")); - when(fileSystem.getSourceDirs()).thenReturn(sourceDirs); - when(fileSystem.getBasedir()).thenReturn(new File(".")); - when(context.getResource(any(Resource.class))).thenReturn(dummyFile); - project.setFileSystem(fileSystem); - - final Collection violations = testedParser.parseReport(new StringInputStream(VALID_REPORT)); - assertFalse(violations.isEmpty()); - } - - -} diff --git a/src/test/java/org/sonar/plugins/objectivec/violations/OCLintSensorTest.java b/src/test/java/org/sonar/plugins/objectivec/violations/OCLintSensorTest.java deleted file mode 100644 index 52bd2ec8..00000000 --- a/src/test/java/org/sonar/plugins/objectivec/violations/OCLintSensorTest.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology - * dev@sonar.codehaus.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.objectivec.violations; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import org.junit.Before; -import org.junit.Test; -import org.sonar.api.batch.fs.FileSystem; -import org.sonar.api.config.Settings; -import org.sonar.api.resources.Project; -import org.sonar.plugins.objectivec.core.ObjectiveC; - -import java.util.SortedSet; -import java.util.TreeSet; - -public final class OCLintSensorTest { - - private Settings settings; - - @Before - public void setUp() { - settings = new Settings(); - } - - @Test - public void shouldExecuteOnProjectShouldBeTrueWhenProjectIsObjc() { - final Project project = new Project("Test"); - - FileSystem fileSystem = mock(FileSystem.class); - SortedSet languages = new TreeSet(); - languages.add(ObjectiveC.KEY); - when(fileSystem.languages()).thenReturn(languages); - - final OCLintSensor testedSensor = new OCLintSensor(fileSystem, settings); - - assertTrue(testedSensor.shouldExecuteOnProject(project)); - } - - @Test - public void shouldExecuteOnProjectShouldBeFalseWhenProjectIsSomethingElse() { - final Project project = new Project("Test"); - - FileSystem fileSystem = mock(FileSystem.class); - SortedSet languages = new TreeSet(); - languages.add("Test"); - when(fileSystem.languages()).thenReturn(languages); - - final OCLintSensor testedSensor = new OCLintSensor(fileSystem, settings); - - assertFalse(testedSensor.shouldExecuteOnProject(project)); - } - -} diff --git a/src/test/java/org/sonar/plugins/objectivec/violations/OCLintXMLStreamHandlerTest.java b/src/test/java/org/sonar/plugins/objectivec/violations/OCLintXMLStreamHandlerTest.java deleted file mode 100644 index 888aeba1..00000000 --- a/src/test/java/org/sonar/plugins/objectivec/violations/OCLintXMLStreamHandlerTest.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology - * dev@sonar.codehaus.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -package org.sonar.plugins.objectivec.violations; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.Matchers.any; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import javax.xml.stream.XMLStreamException; - -import org.apache.tools.ant.filters.StringInputStream; -import org.junit.Test; -import org.sonar.api.batch.SensorContext; -import org.sonar.api.batch.fs.FileSystem; -import org.sonar.api.resources.Project; -import org.sonar.api.resources.ProjectFileSystem; -import org.sonar.api.resources.Resource; -import org.sonar.api.rules.RulePriority; -import org.sonar.api.rules.Violation; -import org.sonar.api.utils.StaxParser; - -public class OCLintXMLStreamHandlerTest { - private static final String EMPTY_REPORT = ""; - private static final String DESCRIPTION = "TEST DESCRIPTION"; - private static final Integer VIOLATION_LINE = Integer.valueOf(99); - private static final String RULE_KEY = "TEST RULE"; - private static final String VALID_REPORT = "" + DESCRIPTION + ""; - private ProjectBuilder projectBuilder; - - @Test - public void streamLeavesTheCollectionEmptyWhenNoLinesAreFound() throws XMLStreamException { - final Collection parseResults = new ArrayList(); - final StaxParser parser = new StaxParser(new OCLintXMLStreamHandler(parseResults, null, null)); - - parser.parse(new StringInputStream(EMPTY_REPORT)); - - assertTrue(parseResults.isEmpty()); - } - - @Test - public void streamAddAviolationForALineInTheReport() throws XMLStreamException { - final org.sonar.api.resources.File dummyFile = new org.sonar.api.resources.File("test"); - givenAProject().containingSourceDirectory("dummy"); - final SensorContext context = mock(SensorContext.class); - - final Collection parseResults = new ArrayList(); - final StaxParser parser = new StaxParser(new OCLintXMLStreamHandler(parseResults, project(), context)); - - when(context.getResource(any(Resource.class))).thenReturn(dummyFile); - - parser.parse(new StringInputStream(VALID_REPORT)); - - assertFalse(parseResults.isEmpty()); - } - - private Project project() { - Project project = givenAProject().project(); - ProjectFileSystem fileSystem = mock(ProjectFileSystem.class); - project.setFileSystem(fileSystem); - when(fileSystem.getBasedir()).thenReturn(new File(".")); - return project; - } - - private ProjectBuilder givenAProject() { - projectBuilder = new ProjectBuilder(); - return projectBuilder; - } - -} diff --git a/updateRules.groovy b/updateRules.groovy index f3a86fda..5697f8f6 100644 --- a/updateRules.groovy +++ b/updateRules.groovy @@ -1,12 +1,21 @@ // Update rules.txt and profile-clint.xml from OCLint documentation -// Severity is determined from the category +// Priority is determined from the category @Grab(group='org.codehaus.groovy.modules.http-builder', module='http-builder', version='0.7') import groovyx.net.http.* +import groovy.util.XmlParser import groovy.xml.MarkupBuilder +// Files +def rulesXml() { + new File('src/main/resources/org/sonar/plugins/objectivec/rules-oclint.xml') +} +def profileXml() { + new File('src/main/resources/org/sonar/plugins/objectivec/profile-oclint.xml') +} + def splitCamelCase(value) { value.replaceAll( String.format("%s|%s|%s", @@ -19,199 +28,103 @@ def splitCamelCase(value) { } -def parseCategory(url, name, severity) { - - def result = [] +def parseCategory(url, name, priority) { + def rules = new XmlParser().parse(rulesXml()) def http = new HTTPBuilder(url) def html = http.get([:]) - def root = html."**".find { it.@id.toString().contains(name)} - root."**".findAll { it.@class.toString() == 'section'}.each {rule -> - - def entry = [:] - - + def root = html.'**'.find { it.@id.toString().contains(name) } + root.'DIV'.each { rule -> def ruleName = splitCamelCase(rule.H2.text() - '¶').capitalize() // Original name - entry.originalName = null + def nameInSource = null try { - def sourceHttp = new HTTPBuilder(rule."**".findAll {it.name() == 'A'}.last().@href) + def sourceUrl = rule."**".find { it.name() == 'A' && it.text().contains('oclint-rules/rules') }.@href.toString() + + // Fixes busted URLs in docs + sourceUrl = sourceUrl.replace('EmptyElseStatementRule.cpp', 'EmptyElseBlockRule.cpp') + sourceUrl = sourceUrl.replace('RedundantNilCheck.cpp', 'RedundantNilCheckRule.cpp') + + def sourceHttp = new HTTPBuilder(sourceUrl) def sourceHtml = sourceHttp.get[:] - def found = sourceHtml."**".find {it.name() == "TR" && it.text().contains("return\"")}.text() + def found = sourceHtml."**".find {it.name() == 'TR' && it.text().contains("return\"")}.text() def match = found =~ /"([^"]*)"/ - entry.originalName = match[0][1] + nameInSource = match[0][1] } catch (Exception e) { } - if (entry.originalName) { - - // Name - entry.name = ruleName - - - println "Retrieving rule $entry.originalName" + if (nameInSource != null) { - // Summary - entry.summary = rule.P[1].text() + // Overrides for key not being properly detected in source + if (ruleName == "Broken nil check") { + nameInSource = "broken nil check" + } + if (ruleName == "Misplaced nil check") { + nameInSource = "misplaced nil check" + } - // Severity - entry.severity = severity + def existingRule = rules.rule.find { it.key.text() == nameInSource } + + if (existingRule) { + existingRule.name[0].value = ruleName + existingRule.description[0].value = rule.P[1].text() + // Keep existing priority + } else { + def newRule = rules.appendNode('rule') + newRule.appendNode('key').value = nameInSource + newRule.appendNode('name').value = ruleName + newRule.appendNode('priority').value = priority + newRule.appendNode('description').value = rule.P[1].text() + } - result.add entry + println "Retrieved rule ${nameInSource}" } else { - println "Unable to retrieve rule with name $entry.name" + println "Unable to retrieve rule with name ${ruleName}" } } - result -} - -def writeRulesTxt(rules, file) { - - def text = "Available issues:\n" + - "\n" + - "OCLint\n" + - "======\n\n" - - rules.each {rule -> - if (rule.name != '') { - text += rule.originalName + '\n' - text += '----------\n' - text += '\n' - - // Summary - text += "Summary: $rule.summary\n" - text += '\n' - - text += "Severity: $rule.severity\n" - text += "Category: OCLint\n" - - text += '\n' - } - } - - file.text = text + def writer = new StringWriter() + def printer = new groovy.util.XmlNodePrinter(new IndentPrinter(writer, " ")) + printer.setPreserveWhitespace true + printer.print(rules) + rulesXml().text = writer.toString() } -def readRulesTxt(file) { - - def result = [] - - def previousLine = '' - def rule = null - file.eachLine {line -> - - if (line.startsWith('--')) { - rule = [:] - rule.originalName = previousLine.trim() - rule.name = rule.originalName - } - - if (line.startsWith('Summary:') && rule) { - rule.summary = (line - 'Summary:').trim() - } - - if (line.startsWith('Severity:') && rule) { - rule.severity = Integer.parseInt((line - 'Severity:').trim()) - } - - if (line.startsWith('Category:') && rule) { - rule.category = (line - 'Category:').trim() - result.add rule - rule = null - } - - previousLine = line - } - - result - -} +def writeProfileOCLint() { + def rulesXml = new XmlParser().parse(rulesXml()) -def writeProfileOCLint(rls, file) { def writer = new StringWriter() - def xml = new MarkupBuilder(writer) + MarkupBuilder xml = new MarkupBuilder(new IndentPrinter(writer, " ")) xml.profile() { name "OCLint" language "objc" rules { - rls.each {rl -> + rulesXml.rule.each { rl -> rule { repositoryKey "OCLint" - key rl.originalName + key rl.key.text() } } } } - file.text = "\n" + writer.toString() - + profileXml().text = writer.toString() } -def mergeRules(existingRules, freshRules) { - - def result = [] - - // Update existing rules - existingRules.each {rule -> - - def freshRule = freshRules.find {it.originalName?.trim() == rule.originalName?.trim()} - if (freshRule) { - - println "Updating rule [$rule.originalName]" - rule.severity = freshRule.severity - rule.category = freshRule.category - rule.summary = freshRule.summary - } - - if (!result.find {it.originalName?.trim() == rule.originalName?.trim()}) { - result.add rule - } else { - println "Skipping rule [$rule.originalName]" - } - } - - // Add new rules (if any) - freshRules.each {rule -> - - def existingRule = existingRules.find {it.originalName?.trim() == rule.originalName?.trim()} - if (!existingRule) { - result.add rule - } - } - - result -} - -// Files -File rulesTxt = new File('src/main/resources/org/sonar/plugins/oclint/rules.txt') -File profileXml = new File('src/main/resources/org/sonar/plugins/oclint/profile-oclint.xml') - // Parse OCLint online documentation -def rules = [] - -rules.addAll parseCategory("http://docs.oclint.org/en/dev/rules/basic.html", "basic", 3) -rules.addAll parseCategory("http://docs.oclint.org/en/dev/rules/convention.html", "convention", 2) -rules.addAll parseCategory("http://docs.oclint.org/en/dev/rules/empty.html", "empty", 3) -rules.addAll parseCategory("http://docs.oclint.org/en/dev/rules/migration.html", "migration", 1) -rules.addAll parseCategory("http://docs.oclint.org/en/dev/rules/naming.html", "naming", 2) -rules.addAll parseCategory("http://docs.oclint.org/en/dev/rules/redundant.html", "redundant", 1) -rules.addAll parseCategory("http://docs.oclint.org/en/dev/rules/size.html", "size", 3) -rules.addAll parseCategory("http://docs.oclint.org/en/dev/rules/unused.html", "unused", 0) -println "${rules.size()} rules found" - - -// Read existing rules -def existingRules = readRulesTxt(rulesTxt) - -// Update existing rules with fresh rules -def finalRules = mergeRules(existingRules, rules) - -writeRulesTxt(finalRules, rulesTxt) -writeProfileOCLint(finalRules, profileXml) \ No newline at end of file +parseCategory("http://docs.oclint.org/en/dev/rules/basic.html", "basic", "CRITICAL") +parseCategory("http://docs.oclint.org/en/dev/rules/convention.html", "convention", "MAJOR") +parseCategory("http://docs.oclint.org/en/dev/rules/empty.html", "empty", "CRITICAL") +parseCategory("http://docs.oclint.org/en/dev/rules/migration.html", "migration", "MINOR") +parseCategory("http://docs.oclint.org/en/dev/rules/naming.html", "naming", "MAJOR") +parseCategory("http://docs.oclint.org/en/dev/rules/redundant.html", "redundant", "MINOR") +parseCategory("http://docs.oclint.org/en/dev/rules/size.html", "size", "CRITICAL") +parseCategory("http://docs.oclint.org/en/dev/rules/unused.html", "unused", "INFO") + +writeProfileOCLint() \ No newline at end of file From e44093dee2a4b21dfc8ffc529597be35b73e5951 Mon Sep 17 00:00:00 2001 From: Matthew DeTullio Date: Mon, 2 Nov 2015 19:56:12 -0500 Subject: [PATCH 25/42] Rename packages --- .../ObjectiveCColorizerFormat.java | 3 +-- .../{cpd => }/ObjectiveCCpdMapping.java | 3 +-- .../plugins/objectivec/ObjectiveCPlugin.java | 20 ++++++++-------- .../{cpd => }/ObjectiveCTokenizer.java | 2 +- .../{issues => clang}/ClangPlistParser.java | 2 +- .../ClangRulesDefinition.java | 2 +- .../{issues => clang}/ClangSensor.java | 2 +- .../{issues => clang}/ClangWarning.java | 2 +- .../{tests => clang}/package-info.java | 2 +- .../CoberturaReportParser.java | 2 +- .../CoberturaSensor.java | 2 +- .../package-info.java | 2 +- .../objectivec/complexity/package-info.java | 23 ------------------- .../LizardReportParser.java | 2 +- .../{complexity => lizard}/LizardSensor.java | 2 +- .../{issues => lizard}/package-info.java | 2 +- .../{violations => oclint}/OCLintParser.java | 2 +- .../{violations => oclint}/OCLintProfile.java | 2 +- .../OCLintProfileImporter.java | 2 +- .../OCLintRulesDefinition.java | 2 +- .../{violations => oclint}/OCLintSensor.java | 2 +- .../{cpd => oclint}/package-info.java | 2 +- .../{tests => surefire}/SurefireParser.java | 2 +- .../{tests => surefire}/SurefireSensor.java | 2 +- .../{coverage => surefire}/package-info.java | 2 +- .../objectivec/violations/package-info.java | 23 ------------------- .../LizardReportParserTest.java | 2 +- .../ProjectBuilder.java | 2 +- 28 files changed, 34 insertions(+), 84 deletions(-) rename src/main/java/org/sonar/plugins/objectivec/{colorizer => }/ObjectiveCColorizerFormat.java (95%) rename src/main/java/org/sonar/plugins/objectivec/{cpd => }/ObjectiveCCpdMapping.java (94%) rename src/main/java/org/sonar/plugins/objectivec/{cpd => }/ObjectiveCTokenizer.java (97%) rename src/main/java/org/sonar/plugins/objectivec/{issues => clang}/ClangPlistParser.java (99%) rename src/main/java/org/sonar/plugins/objectivec/{issues => clang}/ClangRulesDefinition.java (97%) rename src/main/java/org/sonar/plugins/objectivec/{issues => clang}/ClangSensor.java (98%) rename src/main/java/org/sonar/plugins/objectivec/{issues => clang}/ClangWarning.java (97%) rename src/main/java/org/sonar/plugins/objectivec/{tests => clang}/package-info.java (95%) rename src/main/java/org/sonar/plugins/objectivec/{coverage => cobertura}/CoberturaReportParser.java (99%) rename src/main/java/org/sonar/plugins/objectivec/{coverage => cobertura}/CoberturaSensor.java (98%) rename src/main/java/org/sonar/plugins/objectivec/{colorizer => cobertura}/package-info.java (95%) delete mode 100644 src/main/java/org/sonar/plugins/objectivec/complexity/package-info.java rename src/main/java/org/sonar/plugins/objectivec/{complexity => lizard}/LizardReportParser.java (99%) rename src/main/java/org/sonar/plugins/objectivec/{complexity => lizard}/LizardSensor.java (98%) rename src/main/java/org/sonar/plugins/objectivec/{issues => lizard}/package-info.java (95%) rename src/main/java/org/sonar/plugins/objectivec/{violations => oclint}/OCLintParser.java (98%) rename src/main/java/org/sonar/plugins/objectivec/{violations => oclint}/OCLintProfile.java (97%) rename src/main/java/org/sonar/plugins/objectivec/{violations => oclint}/OCLintProfileImporter.java (97%) rename src/main/java/org/sonar/plugins/objectivec/{violations => oclint}/OCLintRulesDefinition.java (97%) rename src/main/java/org/sonar/plugins/objectivec/{violations => oclint}/OCLintSensor.java (98%) rename src/main/java/org/sonar/plugins/objectivec/{cpd => oclint}/package-info.java (95%) rename src/main/java/org/sonar/plugins/objectivec/{tests => surefire}/SurefireParser.java (99%) rename src/main/java/org/sonar/plugins/objectivec/{tests => surefire}/SurefireSensor.java (98%) rename src/main/java/org/sonar/plugins/objectivec/{coverage => surefire}/package-info.java (95%) delete mode 100644 src/main/java/org/sonar/plugins/objectivec/violations/package-info.java rename src/test/java/org/sonar/plugins/objectivec/{complexity => lizard}/LizardReportParserTest.java (99%) rename src/test/java/org/sonar/plugins/objectivec/{violations => oclint}/ProjectBuilder.java (97%) diff --git a/src/main/java/org/sonar/plugins/objectivec/colorizer/ObjectiveCColorizerFormat.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCColorizerFormat.java similarity index 95% rename from src/main/java/org/sonar/plugins/objectivec/colorizer/ObjectiveCColorizerFormat.java rename to src/main/java/org/sonar/plugins/objectivec/ObjectiveCColorizerFormat.java index 9ab68a6a..bb4dfb4f 100644 --- a/src/main/java/org/sonar/plugins/objectivec/colorizer/ObjectiveCColorizerFormat.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCColorizerFormat.java @@ -17,7 +17,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.objectivec.colorizer; +package org.sonar.plugins.objectivec; import com.google.common.collect.ImmutableList; import org.sonar.api.web.CodeColorizerFormat; @@ -28,7 +28,6 @@ import org.sonar.colorizer.StringTokenizer; import org.sonar.colorizer.Tokenizer; import org.sonar.objectivec.api.ObjectiveCKeyword; -import org.sonar.plugins.objectivec.ObjectiveC; import java.util.List; diff --git a/src/main/java/org/sonar/plugins/objectivec/cpd/ObjectiveCCpdMapping.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCCpdMapping.java similarity index 94% rename from src/main/java/org/sonar/plugins/objectivec/cpd/ObjectiveCCpdMapping.java rename to src/main/java/org/sonar/plugins/objectivec/ObjectiveCCpdMapping.java index b3622f7c..70e0ac2b 100644 --- a/src/main/java/org/sonar/plugins/objectivec/cpd/ObjectiveCCpdMapping.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCCpdMapping.java @@ -17,13 +17,12 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.objectivec.cpd; +package org.sonar.plugins.objectivec; import net.sourceforge.pmd.cpd.Tokenizer; import org.sonar.api.batch.AbstractCpdMapping; import org.sonar.api.batch.fs.FileSystem; import org.sonar.api.resources.Language; -import org.sonar.plugins.objectivec.ObjectiveC; import java.nio.charset.Charset; diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java index b3b0a311..a3f8eb1f 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java @@ -22,17 +22,15 @@ import org.sonar.api.SonarPlugin; import org.sonar.api.config.PropertyDefinition; import org.sonar.api.resources.Qualifiers; -import org.sonar.plugins.objectivec.colorizer.ObjectiveCColorizerFormat; -import org.sonar.plugins.objectivec.complexity.LizardSensor; -import org.sonar.plugins.objectivec.coverage.CoberturaSensor; -import org.sonar.plugins.objectivec.cpd.ObjectiveCCpdMapping; -import org.sonar.plugins.objectivec.issues.ClangRulesDefinition; -import org.sonar.plugins.objectivec.issues.ClangSensor; -import org.sonar.plugins.objectivec.tests.SurefireSensor; -import org.sonar.plugins.objectivec.violations.OCLintProfile; -import org.sonar.plugins.objectivec.violations.OCLintProfileImporter; -import org.sonar.plugins.objectivec.violations.OCLintRulesDefinition; -import org.sonar.plugins.objectivec.violations.OCLintSensor; +import org.sonar.plugins.objectivec.clang.ClangRulesDefinition; +import org.sonar.plugins.objectivec.clang.ClangSensor; +import org.sonar.plugins.objectivec.cobertura.CoberturaSensor; +import org.sonar.plugins.objectivec.lizard.LizardSensor; +import org.sonar.plugins.objectivec.oclint.OCLintProfile; +import org.sonar.plugins.objectivec.oclint.OCLintProfileImporter; +import org.sonar.plugins.objectivec.oclint.OCLintRulesDefinition; +import org.sonar.plugins.objectivec.oclint.OCLintSensor; +import org.sonar.plugins.objectivec.surefire.SurefireSensor; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/org/sonar/plugins/objectivec/cpd/ObjectiveCTokenizer.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCTokenizer.java similarity index 97% rename from src/main/java/org/sonar/plugins/objectivec/cpd/ObjectiveCTokenizer.java rename to src/main/java/org/sonar/plugins/objectivec/ObjectiveCTokenizer.java index 3ae13274..7eb5320f 100644 --- a/src/main/java/org/sonar/plugins/objectivec/cpd/ObjectiveCTokenizer.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCTokenizer.java @@ -17,7 +17,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.objectivec.cpd; +package org.sonar.plugins.objectivec; import com.sonar.sslr.api.Token; import com.sonar.sslr.impl.Lexer; diff --git a/src/main/java/org/sonar/plugins/objectivec/issues/ClangPlistParser.java b/src/main/java/org/sonar/plugins/objectivec/clang/ClangPlistParser.java similarity index 99% rename from src/main/java/org/sonar/plugins/objectivec/issues/ClangPlistParser.java rename to src/main/java/org/sonar/plugins/objectivec/clang/ClangPlistParser.java index b373d9f0..92e3f08b 100644 --- a/src/main/java/org/sonar/plugins/objectivec/issues/ClangPlistParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/clang/ClangPlistParser.java @@ -17,7 +17,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.objectivec.issues; +package org.sonar.plugins.objectivec.clang; import com.dd.plist.PropertyListFormatException; import com.dd.plist.XMLPropertyListParser; diff --git a/src/main/java/org/sonar/plugins/objectivec/issues/ClangRulesDefinition.java b/src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java similarity index 97% rename from src/main/java/org/sonar/plugins/objectivec/issues/ClangRulesDefinition.java rename to src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java index 87d51820..f0b3a657 100644 --- a/src/main/java/org/sonar/plugins/objectivec/issues/ClangRulesDefinition.java +++ b/src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java @@ -17,7 +17,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.objectivec.issues; +package org.sonar.plugins.objectivec.clang; import org.sonar.api.server.rule.RulesDefinition; import org.sonar.api.server.rule.RulesDefinitionXmlLoader; diff --git a/src/main/java/org/sonar/plugins/objectivec/issues/ClangSensor.java b/src/main/java/org/sonar/plugins/objectivec/clang/ClangSensor.java similarity index 98% rename from src/main/java/org/sonar/plugins/objectivec/issues/ClangSensor.java rename to src/main/java/org/sonar/plugins/objectivec/clang/ClangSensor.java index daeec72f..741361f4 100644 --- a/src/main/java/org/sonar/plugins/objectivec/issues/ClangSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/clang/ClangSensor.java @@ -17,7 +17,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.objectivec.issues; +package org.sonar.plugins.objectivec.clang; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; diff --git a/src/main/java/org/sonar/plugins/objectivec/issues/ClangWarning.java b/src/main/java/org/sonar/plugins/objectivec/clang/ClangWarning.java similarity index 97% rename from src/main/java/org/sonar/plugins/objectivec/issues/ClangWarning.java rename to src/main/java/org/sonar/plugins/objectivec/clang/ClangWarning.java index ccb708be..ea9f4299 100644 --- a/src/main/java/org/sonar/plugins/objectivec/issues/ClangWarning.java +++ b/src/main/java/org/sonar/plugins/objectivec/clang/ClangWarning.java @@ -17,7 +17,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.objectivec.issues; +package org.sonar.plugins.objectivec.clang; import java.io.File; diff --git a/src/main/java/org/sonar/plugins/objectivec/tests/package-info.java b/src/main/java/org/sonar/plugins/objectivec/clang/package-info.java similarity index 95% rename from src/main/java/org/sonar/plugins/objectivec/tests/package-info.java rename to src/main/java/org/sonar/plugins/objectivec/clang/package-info.java index b3b59e85..bf967697 100644 --- a/src/main/java/org/sonar/plugins/objectivec/tests/package-info.java +++ b/src/main/java/org/sonar/plugins/objectivec/clang/package-info.java @@ -18,6 +18,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ @ParametersAreNonnullByDefault -package org.sonar.plugins.objectivec.tests; +package org.sonar.plugins.objectivec.clang; import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/org/sonar/plugins/objectivec/coverage/CoberturaReportParser.java b/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaReportParser.java similarity index 99% rename from src/main/java/org/sonar/plugins/objectivec/coverage/CoberturaReportParser.java rename to src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaReportParser.java index ecf1a639..1f09c1d3 100644 --- a/src/main/java/org/sonar/plugins/objectivec/coverage/CoberturaReportParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaReportParser.java @@ -17,7 +17,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.objectivec.coverage; +package org.sonar.plugins.objectivec.cobertura; import com.google.common.collect.Maps; import org.apache.commons.lang.StringUtils; diff --git a/src/main/java/org/sonar/plugins/objectivec/coverage/CoberturaSensor.java b/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaSensor.java similarity index 98% rename from src/main/java/org/sonar/plugins/objectivec/coverage/CoberturaSensor.java rename to src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaSensor.java index bc20515f..398ca3d5 100644 --- a/src/main/java/org/sonar/plugins/objectivec/coverage/CoberturaSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaSensor.java @@ -17,7 +17,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.objectivec.coverage; +package org.sonar.plugins.objectivec.cobertura; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; diff --git a/src/main/java/org/sonar/plugins/objectivec/colorizer/package-info.java b/src/main/java/org/sonar/plugins/objectivec/cobertura/package-info.java similarity index 95% rename from src/main/java/org/sonar/plugins/objectivec/colorizer/package-info.java rename to src/main/java/org/sonar/plugins/objectivec/cobertura/package-info.java index dcc7b700..8b04cf3c 100644 --- a/src/main/java/org/sonar/plugins/objectivec/colorizer/package-info.java +++ b/src/main/java/org/sonar/plugins/objectivec/cobertura/package-info.java @@ -18,6 +18,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ @ParametersAreNonnullByDefault -package org.sonar.plugins.objectivec.colorizer; +package org.sonar.plugins.objectivec.cobertura; import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/package-info.java b/src/main/java/org/sonar/plugins/objectivec/complexity/package-info.java deleted file mode 100644 index 8a43ca20..00000000 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology - * dev@sonar.codehaus.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -@ParametersAreNonnullByDefault -package org.sonar.plugins.objectivec.complexity; - -import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java b/src/main/java/org/sonar/plugins/objectivec/lizard/LizardReportParser.java similarity index 99% rename from src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java rename to src/main/java/org/sonar/plugins/objectivec/lizard/LizardReportParser.java index fcabb2d7..09c6b078 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardReportParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/lizard/LizardReportParser.java @@ -17,7 +17,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.objectivec.complexity; +package org.sonar.plugins.objectivec.lizard; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java b/src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java similarity index 98% rename from src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java rename to src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java index 319a037c..f53e18d2 100644 --- a/src/main/java/org/sonar/plugins/objectivec/complexity/LizardSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java @@ -17,7 +17,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.objectivec.complexity; +package org.sonar.plugins.objectivec.lizard; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; diff --git a/src/main/java/org/sonar/plugins/objectivec/issues/package-info.java b/src/main/java/org/sonar/plugins/objectivec/lizard/package-info.java similarity index 95% rename from src/main/java/org/sonar/plugins/objectivec/issues/package-info.java rename to src/main/java/org/sonar/plugins/objectivec/lizard/package-info.java index cfd54956..67ec26e5 100644 --- a/src/main/java/org/sonar/plugins/objectivec/issues/package-info.java +++ b/src/main/java/org/sonar/plugins/objectivec/lizard/package-info.java @@ -18,6 +18,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ @ParametersAreNonnullByDefault -package org.sonar.plugins.objectivec.issues; +package org.sonar.plugins.objectivec.lizard; import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/org/sonar/plugins/objectivec/violations/OCLintParser.java b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintParser.java similarity index 98% rename from src/main/java/org/sonar/plugins/objectivec/violations/OCLintParser.java rename to src/main/java/org/sonar/plugins/objectivec/oclint/OCLintParser.java index e5344db0..60f77f7d 100644 --- a/src/main/java/org/sonar/plugins/objectivec/violations/OCLintParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintParser.java @@ -17,7 +17,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.objectivec.violations; +package org.sonar.plugins.objectivec.oclint; import org.codehaus.staxmate.in.SMHierarchicCursor; import org.codehaus.staxmate.in.SMInputCursor; diff --git a/src/main/java/org/sonar/plugins/objectivec/violations/OCLintProfile.java b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java similarity index 97% rename from src/main/java/org/sonar/plugins/objectivec/violations/OCLintProfile.java rename to src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java index 976758f1..aaf89dba 100644 --- a/src/main/java/org/sonar/plugins/objectivec/violations/OCLintProfile.java +++ b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java @@ -17,7 +17,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.objectivec.violations; +package org.sonar.plugins.objectivec.oclint; import com.google.common.io.Closeables; import org.slf4j.Logger; diff --git a/src/main/java/org/sonar/plugins/objectivec/violations/OCLintProfileImporter.java b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfileImporter.java similarity index 97% rename from src/main/java/org/sonar/plugins/objectivec/violations/OCLintProfileImporter.java rename to src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfileImporter.java index acc06c59..090a6701 100644 --- a/src/main/java/org/sonar/plugins/objectivec/violations/OCLintProfileImporter.java +++ b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfileImporter.java @@ -17,7 +17,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.objectivec.violations; +package org.sonar.plugins.objectivec.oclint; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/src/main/java/org/sonar/plugins/objectivec/violations/OCLintRulesDefinition.java b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintRulesDefinition.java similarity index 97% rename from src/main/java/org/sonar/plugins/objectivec/violations/OCLintRulesDefinition.java rename to src/main/java/org/sonar/plugins/objectivec/oclint/OCLintRulesDefinition.java index c09bd650..360294d6 100644 --- a/src/main/java/org/sonar/plugins/objectivec/violations/OCLintRulesDefinition.java +++ b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintRulesDefinition.java @@ -17,7 +17,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.objectivec.violations; +package org.sonar.plugins.objectivec.oclint; import org.sonar.api.server.rule.RulesDefinition; import org.sonar.api.server.rule.RulesDefinitionXmlLoader; diff --git a/src/main/java/org/sonar/plugins/objectivec/violations/OCLintSensor.java b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintSensor.java similarity index 98% rename from src/main/java/org/sonar/plugins/objectivec/violations/OCLintSensor.java rename to src/main/java/org/sonar/plugins/objectivec/oclint/OCLintSensor.java index 2d5025b8..116bd360 100644 --- a/src/main/java/org/sonar/plugins/objectivec/violations/OCLintSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintSensor.java @@ -17,7 +17,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.objectivec.violations; +package org.sonar.plugins.objectivec.oclint; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; diff --git a/src/main/java/org/sonar/plugins/objectivec/cpd/package-info.java b/src/main/java/org/sonar/plugins/objectivec/oclint/package-info.java similarity index 95% rename from src/main/java/org/sonar/plugins/objectivec/cpd/package-info.java rename to src/main/java/org/sonar/plugins/objectivec/oclint/package-info.java index 483b08c5..e5a03ad9 100644 --- a/src/main/java/org/sonar/plugins/objectivec/cpd/package-info.java +++ b/src/main/java/org/sonar/plugins/objectivec/oclint/package-info.java @@ -18,6 +18,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ @ParametersAreNonnullByDefault -package org.sonar.plugins.objectivec.cpd; +package org.sonar.plugins.objectivec.oclint; import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/org/sonar/plugins/objectivec/tests/SurefireParser.java b/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java similarity index 99% rename from src/main/java/org/sonar/plugins/objectivec/tests/SurefireParser.java rename to src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java index 3732e061..b93b18e5 100644 --- a/src/main/java/org/sonar/plugins/objectivec/tests/SurefireParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java @@ -17,7 +17,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.objectivec.tests; +package org.sonar.plugins.objectivec.surefire; import com.google.common.collect.ImmutableList; import org.apache.commons.lang.StringEscapeUtils; diff --git a/src/main/java/org/sonar/plugins/objectivec/tests/SurefireSensor.java b/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java similarity index 98% rename from src/main/java/org/sonar/plugins/objectivec/tests/SurefireSensor.java rename to src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java index a7b0db82..2aa99eb1 100644 --- a/src/main/java/org/sonar/plugins/objectivec/tests/SurefireSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java @@ -17,7 +17,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.objectivec.tests; +package org.sonar.plugins.objectivec.surefire; import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; diff --git a/src/main/java/org/sonar/plugins/objectivec/coverage/package-info.java b/src/main/java/org/sonar/plugins/objectivec/surefire/package-info.java similarity index 95% rename from src/main/java/org/sonar/plugins/objectivec/coverage/package-info.java rename to src/main/java/org/sonar/plugins/objectivec/surefire/package-info.java index 684e31d5..d20e1dd0 100644 --- a/src/main/java/org/sonar/plugins/objectivec/coverage/package-info.java +++ b/src/main/java/org/sonar/plugins/objectivec/surefire/package-info.java @@ -18,6 +18,6 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ @ParametersAreNonnullByDefault -package org.sonar.plugins.objectivec.coverage; +package org.sonar.plugins.objectivec.surefire; import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/main/java/org/sonar/plugins/objectivec/violations/package-info.java b/src/main/java/org/sonar/plugins/objectivec/violations/package-info.java deleted file mode 100644 index 67b7e11b..00000000 --- a/src/main/java/org/sonar/plugins/objectivec/violations/package-info.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology - * dev@sonar.codehaus.org - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - */ -@ParametersAreNonnullByDefault -package org.sonar.plugins.objectivec.violations; - -import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/src/test/java/org/sonar/plugins/objectivec/complexity/LizardReportParserTest.java b/src/test/java/org/sonar/plugins/objectivec/lizard/LizardReportParserTest.java similarity index 99% rename from src/test/java/org/sonar/plugins/objectivec/complexity/LizardReportParserTest.java rename to src/test/java/org/sonar/plugins/objectivec/lizard/LizardReportParserTest.java index 41b91e4f..8127f55e 100644 --- a/src/test/java/org/sonar/plugins/objectivec/complexity/LizardReportParserTest.java +++ b/src/test/java/org/sonar/plugins/objectivec/lizard/LizardReportParserTest.java @@ -18,7 +18,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.objectivec.complexity; +package org.sonar.plugins.objectivec.lizard; import org.junit.Before; import org.junit.Rule; diff --git a/src/test/java/org/sonar/plugins/objectivec/violations/ProjectBuilder.java b/src/test/java/org/sonar/plugins/objectivec/oclint/ProjectBuilder.java similarity index 97% rename from src/test/java/org/sonar/plugins/objectivec/violations/ProjectBuilder.java rename to src/test/java/org/sonar/plugins/objectivec/oclint/ProjectBuilder.java index 9f6bbebb..01e26785 100644 --- a/src/test/java/org/sonar/plugins/objectivec/violations/ProjectBuilder.java +++ b/src/test/java/org/sonar/plugins/objectivec/oclint/ProjectBuilder.java @@ -17,7 +17,7 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ -package org.sonar.plugins.objectivec.violations; +package org.sonar.plugins.objectivec.oclint; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.when; From 63513a3827c77d60c88eef7818feb5da2c0cddea Mon Sep 17 00:00:00 2001 From: Matthew DeTullio Date: Mon, 2 Nov 2015 22:08:54 -0500 Subject: [PATCH 26/42] Update developers and license owners in pom.xml and headers --- pom.xml | 19 +++++++++++++++---- .../objectivec/ObjectiveCAstScanner.java | 3 ++- .../objectivec/ObjectiveCConfiguration.java | 3 ++- .../objectivec/api/ObjectiveCGrammar.java | 3 ++- .../objectivec/api/ObjectiveCKeyword.java | 3 ++- .../objectivec/api/ObjectiveCMetric.java | 3 ++- .../objectivec/api/ObjectiveCPunctuator.java | 3 ++- .../objectivec/api/ObjectiveCTokenType.java | 3 ++- .../sonar/objectivec/api/package-info.java | 3 ++- .../sonar/objectivec/checks/CheckList.java | 3 ++- .../sonar/objectivec/checks/package-info.java | 3 ++- .../objectivec/lexer/ObjectiveCLexer.java | 3 ++- .../sonar/objectivec/lexer/package-info.java | 3 ++- .../org/sonar/objectivec/package-info.java | 3 ++- .../parser/ObjectiveCGrammarImpl.java | 3 ++- .../objectivec/parser/ObjectiveCParser.java | 3 ++- .../sonar/objectivec/parser/package-info.java | 3 ++- .../sonar/plugins/objectivec/ObjectiveC.java | 3 ++- .../objectivec/ObjectiveCColorizerFormat.java | 3 ++- .../objectivec/ObjectiveCCpdMapping.java | 3 ++- .../plugins/objectivec/ObjectiveCPlugin.java | 3 ++- .../plugins/objectivec/ObjectiveCProfile.java | 3 ++- .../objectivec/ObjectiveCSquidSensor.java | 3 ++- .../objectivec/ObjectiveCTokenizer.java | 3 ++- .../objectivec/clang/ClangPlistParser.java | 3 ++- .../clang/ClangRulesDefinition.java | 3 ++- .../plugins/objectivec/clang/ClangSensor.java | 3 ++- .../objectivec/clang/ClangWarning.java | 3 ++- .../objectivec/clang/package-info.java | 3 ++- .../cobertura/CoberturaReportParser.java | 3 ++- .../objectivec/cobertura/CoberturaSensor.java | 3 ++- .../objectivec/cobertura/package-info.java | 3 ++- .../objectivec/lizard/LizardReportParser.java | 3 ++- .../objectivec/lizard/LizardSensor.java | 3 ++- .../objectivec/lizard/package-info.java | 3 ++- .../objectivec/oclint/OCLintParser.java | 3 ++- .../objectivec/oclint/OCLintProfile.java | 3 ++- .../oclint/OCLintProfileImporter.java | 3 ++- .../oclint/OCLintRulesDefinition.java | 3 ++- .../objectivec/oclint/OCLintSensor.java | 3 ++- .../objectivec/oclint/package-info.java | 3 ++- .../plugins/objectivec/package-info.java | 3 ++- .../objectivec/surefire/SurefireParser.java | 3 ++- .../objectivec/surefire/SurefireSensor.java | 3 ++- .../objectivec/surefire/package-info.java | 3 ++- .../objectivec/ObjectiveCAstScannerTest.java | 3 ++- .../api/ObjectiveCPunctuatorTest.java | 3 ++- .../objectivec/lexer/ObjectiveCLexerTest.java | 3 ++- .../lizard/LizardReportParserTest.java | 4 ++-- .../objectivec/oclint/ProjectBuilder.java | 3 ++- 50 files changed, 113 insertions(+), 54 deletions(-) diff --git a/pom.xml b/pom.xml index dfd19d15..34a8c472 100644 --- a/pom.xml +++ b/pom.xml @@ -56,11 +56,11 @@ Gilles Grousset https://github.com/zippy1978 - + dbregeon Denis Bregeon Incept5 LLC - + fhelg François Helg @@ -77,6 +77,16 @@ Mete Balci https://github.com/metebalci + + agh92 + Andrés Gil Herrera + https://github.com/agh92 + + + mjdetullio + Matthew DeTullio + https://github.com/mjdetullio + scm:git:git@github.com:octo-technology/sonar-objective-c.git @@ -90,7 +100,9 @@ - OCTO Technology + OCTO Technology, Backelite, + Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio + Sonar Objective-C Plugin true @@ -184,5 +196,4 @@ test - diff --git a/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java b/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java index 7ea0df94..e885621e 100644 --- a/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java +++ b/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java b/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java index 068ee412..3a1dcc96 100644 --- a/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java +++ b/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/objectivec/api/ObjectiveCGrammar.java b/src/main/java/org/sonar/objectivec/api/ObjectiveCGrammar.java index f582eea1..e2a71d8e 100644 --- a/src/main/java/org/sonar/objectivec/api/ObjectiveCGrammar.java +++ b/src/main/java/org/sonar/objectivec/api/ObjectiveCGrammar.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java b/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java index 7a2fc61c..69dbde33 100644 --- a/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java +++ b/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java b/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java index ba050d74..2c35c648 100644 --- a/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java +++ b/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java b/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java index d6bba1ad..d8773a0f 100644 --- a/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java +++ b/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java b/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java index 553b7129..04b790a8 100644 --- a/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java +++ b/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/objectivec/api/package-info.java b/src/main/java/org/sonar/objectivec/api/package-info.java index be24db27..2be084af 100644 --- a/src/main/java/org/sonar/objectivec/api/package-info.java +++ b/src/main/java/org/sonar/objectivec/api/package-info.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/objectivec/checks/CheckList.java b/src/main/java/org/sonar/objectivec/checks/CheckList.java index 7de2b77c..1248299f 100644 --- a/src/main/java/org/sonar/objectivec/checks/CheckList.java +++ b/src/main/java/org/sonar/objectivec/checks/CheckList.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/objectivec/checks/package-info.java b/src/main/java/org/sonar/objectivec/checks/package-info.java index 13ef4c7c..3e6c7159 100644 --- a/src/main/java/org/sonar/objectivec/checks/package-info.java +++ b/src/main/java/org/sonar/objectivec/checks/package-info.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java b/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java index 4f65847d..fc735041 100644 --- a/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java +++ b/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/objectivec/lexer/package-info.java b/src/main/java/org/sonar/objectivec/lexer/package-info.java index 70d2f736..b88cf03a 100644 --- a/src/main/java/org/sonar/objectivec/lexer/package-info.java +++ b/src/main/java/org/sonar/objectivec/lexer/package-info.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/objectivec/package-info.java b/src/main/java/org/sonar/objectivec/package-info.java index 7be86d2a..2b3ce472 100644 --- a/src/main/java/org/sonar/objectivec/package-info.java +++ b/src/main/java/org/sonar/objectivec/package-info.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/objectivec/parser/ObjectiveCGrammarImpl.java b/src/main/java/org/sonar/objectivec/parser/ObjectiveCGrammarImpl.java index de51d7f5..f924a421 100644 --- a/src/main/java/org/sonar/objectivec/parser/ObjectiveCGrammarImpl.java +++ b/src/main/java/org/sonar/objectivec/parser/ObjectiveCGrammarImpl.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java b/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java index 6a52ce28..cea79b60 100644 --- a/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java +++ b/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/objectivec/parser/package-info.java b/src/main/java/org/sonar/objectivec/parser/package-info.java index 9537787a..394d483b 100644 --- a/src/main/java/org/sonar/objectivec/parser/package-info.java +++ b/src/main/java/org/sonar/objectivec/parser/package-info.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java index 7d2d6034..894bf4ed 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCColorizerFormat.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCColorizerFormat.java index bb4dfb4f..1feb1026 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCColorizerFormat.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCColorizerFormat.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCCpdMapping.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCCpdMapping.java index 70e0ac2b..010c2789 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCCpdMapping.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCCpdMapping.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java index a3f8eb1f..fd58c0ee 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCProfile.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCProfile.java index 000d1ddb..4e6514ec 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCProfile.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCProfile.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java index 715abb61..625870b5 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCTokenizer.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCTokenizer.java index 7eb5320f..ef8aa835 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCTokenizer.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCTokenizer.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/clang/ClangPlistParser.java b/src/main/java/org/sonar/plugins/objectivec/clang/ClangPlistParser.java index 92e3f08b..cad162b9 100644 --- a/src/main/java/org/sonar/plugins/objectivec/clang/ClangPlistParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/clang/ClangPlistParser.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java b/src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java index f0b3a657..5ff65241 100644 --- a/src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java +++ b/src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/clang/ClangSensor.java b/src/main/java/org/sonar/plugins/objectivec/clang/ClangSensor.java index 741361f4..e9499b00 100644 --- a/src/main/java/org/sonar/plugins/objectivec/clang/ClangSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/clang/ClangSensor.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/clang/ClangWarning.java b/src/main/java/org/sonar/plugins/objectivec/clang/ClangWarning.java index ea9f4299..d7cd2534 100644 --- a/src/main/java/org/sonar/plugins/objectivec/clang/ClangWarning.java +++ b/src/main/java/org/sonar/plugins/objectivec/clang/ClangWarning.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/clang/package-info.java b/src/main/java/org/sonar/plugins/objectivec/clang/package-info.java index bf967697..0ba04140 100644 --- a/src/main/java/org/sonar/plugins/objectivec/clang/package-info.java +++ b/src/main/java/org/sonar/plugins/objectivec/clang/package-info.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaReportParser.java b/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaReportParser.java index 1f09c1d3..c8900506 100644 --- a/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaReportParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaReportParser.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaSensor.java b/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaSensor.java index 398ca3d5..ad84b738 100644 --- a/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaSensor.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/cobertura/package-info.java b/src/main/java/org/sonar/plugins/objectivec/cobertura/package-info.java index 8b04cf3c..8c218598 100644 --- a/src/main/java/org/sonar/plugins/objectivec/cobertura/package-info.java +++ b/src/main/java/org/sonar/plugins/objectivec/cobertura/package-info.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/lizard/LizardReportParser.java b/src/main/java/org/sonar/plugins/objectivec/lizard/LizardReportParser.java index 09c6b078..a524b31a 100644 --- a/src/main/java/org/sonar/plugins/objectivec/lizard/LizardReportParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/lizard/LizardReportParser.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java b/src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java index f53e18d2..0bce156a 100644 --- a/src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/lizard/package-info.java b/src/main/java/org/sonar/plugins/objectivec/lizard/package-info.java index 67ec26e5..35a75a60 100644 --- a/src/main/java/org/sonar/plugins/objectivec/lizard/package-info.java +++ b/src/main/java/org/sonar/plugins/objectivec/lizard/package-info.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintParser.java b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintParser.java index 60f77f7d..78a369dd 100644 --- a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintParser.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java index aaf89dba..0a38e71a 100644 --- a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java +++ b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfileImporter.java b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfileImporter.java index 090a6701..7f42511b 100644 --- a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfileImporter.java +++ b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfileImporter.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintRulesDefinition.java b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintRulesDefinition.java index 360294d6..ebf68057 100644 --- a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintRulesDefinition.java +++ b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintRulesDefinition.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintSensor.java b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintSensor.java index 116bd360..0baaf444 100644 --- a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintSensor.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/oclint/package-info.java b/src/main/java/org/sonar/plugins/objectivec/oclint/package-info.java index e5a03ad9..3a365c43 100644 --- a/src/main/java/org/sonar/plugins/objectivec/oclint/package-info.java +++ b/src/main/java/org/sonar/plugins/objectivec/oclint/package-info.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/package-info.java b/src/main/java/org/sonar/plugins/objectivec/package-info.java index 6c5a8e45..ab3241c8 100644 --- a/src/main/java/org/sonar/plugins/objectivec/package-info.java +++ b/src/main/java/org/sonar/plugins/objectivec/package-info.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java b/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java index b93b18e5..fbed3da0 100644 --- a/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java b/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java index 2aa99eb1..c765d01f 100644 --- a/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/package-info.java b/src/main/java/org/sonar/plugins/objectivec/surefire/package-info.java index d20e1dd0..793c1666 100644 --- a/src/main/java/org/sonar/plugins/objectivec/surefire/package-info.java +++ b/src/main/java/org/sonar/plugins/objectivec/surefire/package-info.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/test/java/org/sonar/objectivec/ObjectiveCAstScannerTest.java b/src/test/java/org/sonar/objectivec/ObjectiveCAstScannerTest.java index ea40f1f6..0125317f 100644 --- a/src/test/java/org/sonar/objectivec/ObjectiveCAstScannerTest.java +++ b/src/test/java/org/sonar/objectivec/ObjectiveCAstScannerTest.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/test/java/org/sonar/objectivec/api/ObjectiveCPunctuatorTest.java b/src/test/java/org/sonar/objectivec/api/ObjectiveCPunctuatorTest.java index 052b19c2..625e816a 100644 --- a/src/test/java/org/sonar/objectivec/api/ObjectiveCPunctuatorTest.java +++ b/src/test/java/org/sonar/objectivec/api/ObjectiveCPunctuatorTest.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java b/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java index 080c41cf..20d03f8c 100644 --- a/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java +++ b/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or diff --git a/src/test/java/org/sonar/plugins/objectivec/lizard/LizardReportParserTest.java b/src/test/java/org/sonar/plugins/objectivec/lizard/LizardReportParserTest.java index 8127f55e..2c9d9e7b 100644 --- a/src/test/java/org/sonar/plugins/objectivec/lizard/LizardReportParserTest.java +++ b/src/test/java/org/sonar/plugins/objectivec/lizard/LizardReportParserTest.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or @@ -17,7 +18,6 @@ * License along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 */ - package org.sonar.plugins.objectivec.lizard; import org.junit.Before; diff --git a/src/test/java/org/sonar/plugins/objectivec/oclint/ProjectBuilder.java b/src/test/java/org/sonar/plugins/objectivec/oclint/ProjectBuilder.java index 01e26785..1320dcaf 100644 --- a/src/test/java/org/sonar/plugins/objectivec/oclint/ProjectBuilder.java +++ b/src/test/java/org/sonar/plugins/objectivec/oclint/ProjectBuilder.java @@ -1,6 +1,7 @@ /* * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio * dev@sonar.codehaus.org * * This program is free software; you can redistribute it and/or From 9bc51302ad48f9f6882d24653a2a61216d41090b Mon Sep 17 00:00:00 2001 From: Matthew DeTullio Date: Mon, 2 Nov 2015 22:11:18 -0500 Subject: [PATCH 27/42] Fix plugin name --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 34a8c472..491d6dbf 100644 --- a/pom.xml +++ b/pom.xml @@ -112,7 +112,7 @@ org.sonar.plugins.objectivec.ObjectiveCPlugin - ObjectiveC + Objective-C From 0316a6ab2a6cd2f0c4794382bdd0e5fc32f358ea Mon Sep 17 00:00:00 2001 From: Matthew DeTullio Date: Mon, 2 Nov 2015 21:32:56 -0500 Subject: [PATCH 28/42] Initial set of Clang rules. Add Clang profile. --- .../plugins/objectivec/ObjectiveCPlugin.java | 4 + .../objectivec/clang/ClangPlistParser.java | 2 +- .../objectivec/clang/ClangProfile.java | 61 +++++++ .../clang/ClangProfileImporter.java | 57 ++++++ .../clang/ClangRulesDefinition.java | 23 ++- .../plugins/objectivec/clang/ClangSensor.java | 16 +- .../objectivec/oclint/OCLintProfile.java | 2 +- .../oclint/OCLintProfileImporter.java | 2 +- .../objectivec/surefire/SurefireParser.java | 2 +- .../objectivec/surefire/SurefireSensor.java | 2 +- .../resources/com/sonar/sqale/clang-model.xml | 162 ++++++++++++++++++ .../plugins/objectivec/profile-clang.xml | 46 +++++ .../sonar/plugins/objectivec/rules-clang.xml | 56 +++++- 13 files changed, 424 insertions(+), 11 deletions(-) create mode 100644 src/main/java/org/sonar/plugins/objectivec/clang/ClangProfile.java create mode 100644 src/main/java/org/sonar/plugins/objectivec/clang/ClangProfileImporter.java create mode 100644 src/main/resources/org/sonar/plugins/objectivec/profile-clang.xml diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java index fd58c0ee..7e3427b9 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java @@ -23,6 +23,8 @@ import org.sonar.api.SonarPlugin; import org.sonar.api.config.PropertyDefinition; import org.sonar.api.resources.Qualifiers; +import org.sonar.plugins.objectivec.clang.ClangProfile; +import org.sonar.plugins.objectivec.clang.ClangProfileImporter; import org.sonar.plugins.objectivec.clang.ClangRulesDefinition; import org.sonar.plugins.objectivec.clang.ClangSensor; import org.sonar.plugins.objectivec.cobertura.CoberturaSensor; @@ -56,6 +58,8 @@ public List getExtensions() { extensions.add(ClangRulesDefinition.class); extensions.add(ClangSensor.class); + extensions.add(ClangProfile.class); + extensions.add(ClangProfileImporter.class); extensions.add(PropertyDefinition.builder(ClangSensor.REPORTS_PATH_KEY) .name("Clang Static Analyzer Reports") .description("Path to the directory containing all the *.plist Clang report files. The path may be absolute or relative to the project base directory.") diff --git a/src/main/java/org/sonar/plugins/objectivec/clang/ClangPlistParser.java b/src/main/java/org/sonar/plugins/objectivec/clang/ClangPlistParser.java index cad162b9..48b279cd 100644 --- a/src/main/java/org/sonar/plugins/objectivec/clang/ClangPlistParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/clang/ClangPlistParser.java @@ -39,7 +39,7 @@ /** * @author Matthew DeTullio */ -public class ClangPlistParser { +public final class ClangPlistParser { private static final Logger LOGGER = LoggerFactory.getLogger(ClangPlistParser.class); public static List parse(final File reportsDir) { diff --git a/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfile.java b/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfile.java new file mode 100644 index 00000000..5ff64831 --- /dev/null +++ b/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfile.java @@ -0,0 +1,61 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.plugins.objectivec.clang; + +import com.google.common.io.Closeables; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sonar.api.profiles.ProfileDefinition; +import org.sonar.api.profiles.RulesProfile; +import org.sonar.api.utils.ValidationMessages; +import org.sonar.plugins.objectivec.ObjectiveC; + +import java.io.InputStreamReader; +import java.io.Reader; + +public final class ClangProfile extends ProfileDefinition { + private static final Logger LOGGER = LoggerFactory.getLogger(ClangProfile.class); + + private final ClangProfileImporter importer; + + public ClangProfile(final ClangProfileImporter importer) { + this.importer = importer; + } + + @Override + public RulesProfile createProfile(final ValidationMessages messages) { + LOGGER.info("Creating Clang Profile"); + Reader profileXmlReader = null; + + try { + profileXmlReader = new InputStreamReader(ClangProfile.class.getResourceAsStream( + "/org/sonar/plugins/objectivec/profile-clang.xml")); + + RulesProfile profile = importer.importProfile(profileXmlReader, messages); + profile.setLanguage(ObjectiveC.KEY); + profile.setName(ClangRulesDefinition.REPOSITORY_NAME); + + return profile; + } finally { + Closeables.closeQuietly(profileXmlReader); + } + } +} diff --git a/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfileImporter.java b/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfileImporter.java new file mode 100644 index 00000000..3241fa02 --- /dev/null +++ b/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfileImporter.java @@ -0,0 +1,57 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.plugins.objectivec.clang; + +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.sonar.api.profiles.ProfileImporter; +import org.sonar.api.profiles.RulesProfile; +import org.sonar.api.profiles.XMLProfileParser; +import org.sonar.api.utils.ValidationMessages; +import org.sonar.plugins.objectivec.ObjectiveC; + +import java.io.Reader; + +public final class ClangProfileImporter extends ProfileImporter { + private static final Logger LOGGER = LoggerFactory.getLogger(ClangProfileImporter.class); + private static final String UNABLE_TO_LOAD_DEFAULT_PROFILE = "Unable to load default Clang profile"; + + private final XMLProfileParser profileParser; + + public ClangProfileImporter(final XMLProfileParser xmlProfileParser) { + super(ClangRulesDefinition.REPOSITORY_KEY, ClangRulesDefinition.REPOSITORY_NAME); + setSupportedLanguages(ObjectiveC.KEY); + profileParser = xmlProfileParser; + } + + @Override + public RulesProfile importProfile(final Reader reader, + final ValidationMessages messages) { + final RulesProfile profile = profileParser.parse(reader, messages); + + if (null == profile) { + messages.addErrorText(UNABLE_TO_LOAD_DEFAULT_PROFILE); + LOGGER.error(UNABLE_TO_LOAD_DEFAULT_PROFILE); + } + + return profile; + } +} diff --git a/src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java b/src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java index 5ff65241..dc9b2aaa 100644 --- a/src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java +++ b/src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java @@ -20,18 +20,39 @@ */ package org.sonar.plugins.objectivec.clang; +import com.google.common.collect.ImmutableMap; import org.sonar.api.server.rule.RulesDefinition; import org.sonar.api.server.rule.RulesDefinitionXmlLoader; import org.sonar.plugins.objectivec.ObjectiveC; import org.sonar.squidbridge.rules.SqaleXmlLoader; +import java.util.Map; + /** * @author Matthew DeTullio */ -public class ClangRulesDefinition implements RulesDefinition { +public final class ClangRulesDefinition implements RulesDefinition { public static final String REPOSITORY_KEY = "clang"; public static final String REPOSITORY_NAME = "Clang"; + /** + * Map of Clang plist report types to their corresponding rules. Multiple types can map to a single + * rule. + */ + public static final Map REPORT_TYPE_TO_RULE_MAP = ImmutableMap.builder() + .put("Assigned value is garbage or undefined", "core.uninitialized.Assign") // Logic error + .put("Bad return type when passing NSError**", "osx.cocoa.NSError") // Coding conventions (Apple) + .put("Branch condition evaluates to a garbage value", "core.uninitialized.Branch") // Logic error + .put("Dead assignment", "deadcode.DeadStores") // Dead store + .put("Dead increment", "deadcode.DeadStores") // Dead store + .put("Dead initialization", "deadcode.DeadStores") // Dead store + .put("Garbage return value", "core.uninitialized.UndefReturn") // Logic error + .put("Leak", "osx.cocoa.RetainCount") // Memory (Core Foundation/Objective-C) + .put("Missing call to superclass", "osx.cocoa.MissingSuperCall") // Core Foundation/Objective-C + .put("Nil value used as mutex for @synchronized() (no synchronization will occur)", "osx.cocoa.AtSync") // Logic error + .put("Result of operation is garbage or undefined", "core.UndefinedBinaryOperatorResult") // Logic error + .build(); + @Override public void define(Context context) { NewRepository repository = context diff --git a/src/main/java/org/sonar/plugins/objectivec/clang/ClangSensor.java b/src/main/java/org/sonar/plugins/objectivec/clang/ClangSensor.java index e9499b00..37b2ddba 100644 --- a/src/main/java/org/sonar/plugins/objectivec/clang/ClangSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/clang/ClangSensor.java @@ -42,7 +42,7 @@ /** * @author Matthew DeTullio */ -public class ClangSensor implements Sensor { +public final class ClangSensor implements Sensor { private static final Logger LOGGER = LoggerFactory.getLogger(ClangSensor.class.getName()); public static final String REPORTS_PATH_KEY = "sonar.objectivec.clang.reportsPath"; @@ -84,7 +84,15 @@ protected void collect(Project project, SensorContext context, File reportsDir) List clangWarnings = ClangPlistParser.parse(reportsDir); for (ClangWarning clangWarning : clangWarnings) { - // TODO: Add check for enabled rule if/when rules get split up + String type = clangWarning.getType(); + String ruleKeyName; + + if (ClangRulesDefinition.REPORT_TYPE_TO_RULE_MAP.containsKey(type)) { + ruleKeyName = ClangRulesDefinition.REPORT_TYPE_TO_RULE_MAP.get(type); + } else { + ruleKeyName = "other"; + LOGGER.debug("Type '{}' is not mapped to a rule -- using default rule '{}'", type, ruleKeyName); + } Resource resource = context.getResource( org.sonar.api.resources.File.fromIOFile(clangWarning.getFile(), project)); @@ -98,8 +106,8 @@ protected void collect(Project project, SensorContext context, File reportsDir) if (issuable != null) { Issue issue = issuable.newIssueBuilder() - .ruleKey(RuleKey.of(ClangRulesDefinition.REPOSITORY_KEY, "other")) - .message(String.format("%s - %s", clangWarning.getCategory(), clangWarning.getType())) + .ruleKey(RuleKey.of(ClangRulesDefinition.REPOSITORY_KEY, ruleKeyName)) + .message(String.format("%s - %s", clangWarning.getCategory(), type)) .line(clangWarning.getLine()) .build(); diff --git a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java index 0a38e71a..f896b24a 100644 --- a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java +++ b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java @@ -51,7 +51,7 @@ public RulesProfile createProfile(final ValidationMessages messages) { RulesProfile profile = importer.importProfile(profileXmlReader, messages); profile.setLanguage(ObjectiveC.KEY); - profile.setName(OCLintRulesDefinition.REPOSITORY_KEY); + profile.setName(OCLintRulesDefinition.REPOSITORY_NAME); profile.setDefaultProfile(true); return profile; diff --git a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfileImporter.java b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfileImporter.java index 7f42511b..a4970402 100644 --- a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfileImporter.java +++ b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfileImporter.java @@ -37,7 +37,7 @@ public final class OCLintProfileImporter extends ProfileImporter { private final XMLProfileParser profileParser; public OCLintProfileImporter(final XMLProfileParser xmlProfileParser) { - super(OCLintRulesDefinition.REPOSITORY_KEY, OCLintRulesDefinition.REPOSITORY_KEY); + super(OCLintRulesDefinition.REPOSITORY_KEY, OCLintRulesDefinition.REPOSITORY_NAME); setSupportedLanguages(ObjectiveC.KEY); profileParser = xmlProfileParser; } diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java b/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java index fbed3da0..65007c46 100644 --- a/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java @@ -48,7 +48,7 @@ import java.util.List; import java.util.Set; -public class SurefireParser { +public final class SurefireParser { private static final Logger LOGGER = LoggerFactory.getLogger(SurefireParser.class); private final Project project; diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java b/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java index c765d01f..555272d6 100644 --- a/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java @@ -32,7 +32,7 @@ import java.io.File; -public class SurefireSensor implements Sensor { +public final class SurefireSensor implements Sensor { private static final Logger LOGGER = LoggerFactory.getLogger(SurefireSensor.class); public static final String REPORTS_PATH_KEY = "sonar.objectivec.junit.reportsPath"; diff --git a/src/main/resources/com/sonar/sqale/clang-model.xml b/src/main/resources/com/sonar/sqale/clang-model.xml index 62db4417..ba8c52e7 100644 --- a/src/main/resources/com/sonar/sqale/clang-model.xml +++ b/src/main/resources/com/sonar/sqale/clang-model.xml @@ -77,6 +77,24 @@ MEMORY_EFFICIENCY Memory use + + clang + osx.cocoa.RetainCount + + remediationFunction + CONSTANT_ISSUE + + + remediationFactor + 0.0 + d + + + offset + 30.0 + mn + + CPU_EFFICIENCY @@ -105,10 +123,136 @@ ARCHITECTURE_RELIABILITY Architecture + + clang + osx.cocoa.NSError + + remediationFunction + CONSTANT_ISSUE + + + remediationFactor + 0.0 + d + + + offset + 30.0 + mn + + + + clang + osx.cocoa.MissingSuperCall + + remediationFunction + CONSTANT_ISSUE + + + remediationFactor + 0.0 + d + + + offset + 30.0 + mn + + DATA_RELIABILITY Data + + clang + core.UndefinedBinaryOperatorResult + + remediationFunction + CONSTANT_ISSUE + + + remediationFactor + 0.0 + d + + + offset + 30.0 + mn + + + + clang + core.uninitialized.Assign + + remediationFunction + CONSTANT_ISSUE + + + remediationFactor + 0.0 + d + + + offset + 30.0 + mn + + + + clang + core.uninitialized.Branch + + remediationFunction + CONSTANT_ISSUE + + + remediationFactor + 0.0 + d + + + offset + 30.0 + mn + + + + clang + core.uninitialized.UndefReturn + + remediationFunction + CONSTANT_ISSUE + + + remediationFactor + 0.0 + d + + + offset + 30.0 + mn + + + + clang + deadcode.DeadStores + + remediationFunction + CONSTANT_ISSUE + + + remediationFactor + 0.0 + d + + + offset + 30.0 + mn + + EXCEPTION_HANDLING @@ -151,6 +295,24 @@ SYNCHRONIZATION_RELIABILITY Synchronization + + clang + osx.cocoa.AtSync + + remediationFunction + CONSTANT_ISSUE + + + remediationFactor + 0.0 + d + + + offset + 30.0 + mn + + UNIT_TESTS diff --git a/src/main/resources/org/sonar/plugins/objectivec/profile-clang.xml b/src/main/resources/org/sonar/plugins/objectivec/profile-clang.xml new file mode 100644 index 00000000..dc003b7a --- /dev/null +++ b/src/main/resources/org/sonar/plugins/objectivec/profile-clang.xml @@ -0,0 +1,46 @@ + + Clang + objc + + + clang + core.UndefinedBinaryOperatorResult + + + clang + core.uninitialized.Assign + + + clang + core.uninitialized.Branch + + + clang + core.uninitialized.UndefReturn + + + clang + deadcode.DeadStores + + + clang + osx.cocoa.AtSync + + + clang + osx.cocoa.MissingSuperCall + + + clang + osx.cocoa.NSError + + + clang + osx.cocoa.RetainCount + + + clang + other + + + \ No newline at end of file diff --git a/src/main/resources/org/sonar/plugins/objectivec/rules-clang.xml b/src/main/resources/org/sonar/plugins/objectivec/rules-clang.xml index 5b52905a..2813133d 100644 --- a/src/main/resources/org/sonar/plugins/objectivec/rules-clang.xml +++ b/src/main/resources/org/sonar/plugins/objectivec/rules-clang.xml @@ -1,7 +1,61 @@ + + core.UndefinedBinaryOperatorResult + Check for undefined results of binary operators + MAJOR + Check for undefined results of binary operators + + + core.uninitialized.Assign + Check for assigning uninitialized values + MAJOR + Check for assigning uninitialized values + + + core.uninitialized.Branch + Check for uninitialized values used as branch conditions + MAJOR + Check for uninitialized values used as branch conditions + + + core.uninitialized.UndefReturn + Check for uninitialized values being returned to the caller + MAJOR + Check for uninitialized values being returned to the caller + + + deadcode.DeadStores + Check for values stored to variables that are never read afterwards + MAJOR + Check for values stored to variables that are never read afterwards + + + osx.cocoa.AtSync + Check for nil pointers used as mutexes for @synchronized + MAJOR + Check for nil pointers used as mutexes for @synchronized + + + osx.cocoa.MissingSuperCall + Warn about Objective-C methods that lack a necessary call to super + MAJOR + Warn about Objective-C methods that lack a necessary call to super + + + osx.cocoa.NSError + Check usage of NSError** parameters + MAJOR + Check usage of NSError** parameters + + + osx.cocoa.RetainCount + Check for leaks and violations of the Cocoa Memory Management rules + CRITICAL + Check for leaks and violations of the Cocoa Memory Management rules + other - Clang Static Analyzer warning - other + All other Clang Static Analyzer warnings MAJOR Warning reported by Clang Static Analyzer (uncategorized). From 2733aff09605f3ac6e735b2ab697c7514c6aa0c1 Mon Sep 17 00:00:00 2001 From: Matthew DeTullio Date: Tue, 3 Nov 2015 19:31:37 -0500 Subject: [PATCH 29/42] Update Surefire sensor with code from sonar-java --- pom.xml | 5 - .../objectivec/surefire/SurefireParser.java | 157 ++++++++++-------- .../objectivec/surefire/SurefireSensor.java | 8 +- .../surefire/data/SurefireStaxHandler.java | 143 ++++++++++++++++ .../surefire/data/UnitTestClassReport.java | 103 ++++++++++++ .../surefire/data/UnitTestIndex.java | 81 +++++++++ .../surefire/data/UnitTestResult.java | 87 ++++++++++ .../surefire/data/package-info.java | 24 +++ .../objectivec/surefire/package-info.java | 2 +- 9 files changed, 530 insertions(+), 80 deletions(-) create mode 100644 src/main/java/org/sonar/plugins/objectivec/surefire/data/SurefireStaxHandler.java create mode 100644 src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestClassReport.java create mode 100644 src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestIndex.java create mode 100644 src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestResult.java create mode 100644 src/main/java/org/sonar/plugins/objectivec/surefire/data/package-info.java diff --git a/pom.xml b/pom.xml index 491d6dbf..5d58e063 100644 --- a/pom.xml +++ b/pom.xml @@ -142,11 +142,6 @@ sslr-squid-bridge 2.5.3 - - org.codehaus.sonar.plugins - sonar-surefire-plugin - 2.7 - com.googlecode.plist dd-plist diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java b/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java index 65007c46..9e0726e8 100644 --- a/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java @@ -21,44 +21,49 @@ package org.sonar.plugins.objectivec.surefire; import com.google.common.collect.ImmutableList; -import org.apache.commons.lang.StringEscapeUtils; +import org.apache.commons.lang.StringUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.batch.SensorContext; import org.sonar.api.batch.fs.FileSystem; import org.sonar.api.batch.fs.InputFile; +import org.sonar.api.component.ResourcePerspectives; import org.sonar.api.measures.CoreMetrics; -import org.sonar.api.measures.Measure; import org.sonar.api.measures.Metric; import org.sonar.api.resources.Project; import org.sonar.api.resources.Qualifiers; import org.sonar.api.resources.Resource; +import org.sonar.api.test.MutableTestPlan; +import org.sonar.api.test.TestCase; import org.sonar.api.utils.ParsingUtils; +import org.sonar.api.utils.SonarException; import org.sonar.api.utils.StaxParser; -import org.sonar.api.utils.XmlParserException; import org.sonar.plugins.objectivec.ObjectiveC; -import org.sonar.plugins.surefire.TestCaseDetails; -import org.sonar.plugins.surefire.TestSuiteParser; -import org.sonar.plugins.surefire.TestSuiteReport; +import org.sonar.plugins.objectivec.surefire.data.SurefireStaxHandler; +import org.sonar.plugins.objectivec.surefire.data.UnitTestClassReport; +import org.sonar.plugins.objectivec.surefire.data.UnitTestIndex; +import org.sonar.plugins.objectivec.surefire.data.UnitTestResult; -import javax.xml.transform.TransformerException; +import javax.xml.stream.XMLStreamException; import java.io.File; import java.io.FilenameFilter; -import java.util.HashSet; import java.util.List; -import java.util.Set; +import java.util.Map; public final class SurefireParser { private static final Logger LOGGER = LoggerFactory.getLogger(SurefireParser.class); + private final FileSystem fileSystem; private final Project project; private final SensorContext context; - private final FileSystem fileSystem; + private final ResourcePerspectives perspectives; - public SurefireParser(Project project, SensorContext context, FileSystem fileSystem) { + public SurefireParser(FileSystem fileSystem, Project project, ResourcePerspectives perspectives, + SensorContext context) { + this.fileSystem = fileSystem; this.project = project; + this.perspectives = perspectives; this.context = context; - this.fileSystem = fileSystem; } public void collect(File reportsDir) { @@ -88,75 +93,78 @@ private void insertZeroWhenNoReports() { } private void parseFiles(File[] reports) { - Set analyzedReports = new HashSet(); - try { - for (File report : reports) { - TestSuiteParser parserHandler = new TestSuiteParser(); - StaxParser parser = new StaxParser(parserHandler, false); - parser.parse(report); + UnitTestIndex index = new UnitTestIndex(); + parseFiles(reports, index); + sanitize(index); + save(index); + } - for (TestSuiteReport fileReport : parserHandler.getParsedReports()) { - if (!fileReport.isValid() || analyzedReports.contains(fileReport)) { - continue; - } - if (fileReport.getTests() > 0) { - double testsCount = fileReport.getTests() - fileReport.getSkipped(); - saveClassMeasure(fileReport, CoreMetrics.SKIPPED_TESTS, fileReport.getSkipped()); - saveClassMeasure(fileReport, CoreMetrics.TESTS, testsCount); - saveClassMeasure(fileReport, CoreMetrics.TEST_ERRORS, fileReport.getErrors()); - saveClassMeasure(fileReport, CoreMetrics.TEST_FAILURES, fileReport.getFailures()); - saveClassMeasure(fileReport, CoreMetrics.TEST_EXECUTION_TIME, fileReport.getTimeMS()); - double passedTests = testsCount - fileReport.getErrors() - fileReport.getFailures(); - if (testsCount > 0) { - double percentage = passedTests * 100d / testsCount; - saveClassMeasure(fileReport, CoreMetrics.TEST_SUCCESS_DENSITY, ParsingUtils.scaleValue(percentage)); - } - saveTestsDetails(fileReport); - analyzedReports.add(fileReport); - } - } + private static void parseFiles(File[] reports, UnitTestIndex index) { + SurefireStaxHandler staxParser = new SurefireStaxHandler(index); + StaxParser parser = new StaxParser(staxParser, false); + for (File report : reports) { + try { + parser.parse(report); + } catch (XMLStreamException e) { + throw new SonarException("Fail to parse the Surefire report: " + report, e); } - - } catch (Exception e) { - throw new XmlParserException("Can not parse surefire reports", e); } } - private void saveTestsDetails(TestSuiteReport fileReport) throws TransformerException { - StringBuilder testCaseDetails = new StringBuilder(256); - testCaseDetails.append(""); - List details = fileReport.getDetails(); - for (TestCaseDetails detail : details) { - testCaseDetails.append("") - .append(isError ? "") - .append("") - .append(isError ? "" : "").append(""); - } else { - testCaseDetails.append("/>"); + private static void sanitize(UnitTestIndex index) { + for (String classname : index.getClassnames()) { + if (StringUtils.contains(classname, "$")) { + // Surefire reports classes whereas sonar supports files + String parentClassName = StringUtils.substringBefore(classname, "$"); + index.merge(classname, parentClassName); } } - testCaseDetails.append(""); - context.saveMeasure(getUnitTestResource(fileReport.getClassKey()), new Measure(CoreMetrics.TEST_DATA, testCaseDetails.toString())); } - private void saveClassMeasure(TestSuiteReport fileReport, Metric metric, double value) { - if (!Double.isNaN(value)) { - - String className = fileReport.getClassKey(); + private void save(UnitTestIndex index) { + long negativeTimeTestNumber = 0; + for (Map.Entry entry : index.getIndexByClassname().entrySet()) { + UnitTestClassReport report = entry.getValue(); + if (report.getTests() > 0) { + negativeTimeTestNumber += report.getNegativeTimeTestNumber(); + Resource resource = getUnitTestResource(entry.getKey()); + if (resource != null) { + save(report, resource); + } else { + LOGGER.warn("Resource not found: {}", entry.getKey()); + } + } + } + if (negativeTimeTestNumber > 0) { + LOGGER.warn("There is {} test(s) reported with negative time by surefire, total duration may not be accurate.", negativeTimeTestNumber); + } + } - context.saveMeasure(getUnitTestResource(className), metric, value); + private void save(UnitTestClassReport report, Resource resource) { + double testsCount = report.getTests() - report.getSkipped(); + saveMeasure(resource, CoreMetrics.SKIPPED_TESTS, report.getSkipped()); + saveMeasure(resource, CoreMetrics.TESTS, testsCount); + saveMeasure(resource, CoreMetrics.TEST_ERRORS, report.getErrors()); + saveMeasure(resource, CoreMetrics.TEST_FAILURES, report.getFailures()); + saveMeasure(resource, CoreMetrics.TEST_EXECUTION_TIME, report.getDurationMilliseconds()); + double passedTests = testsCount - report.getErrors() - report.getFailures(); + if (testsCount > 0) { + double percentage = passedTests * 100d / testsCount; + saveMeasure(resource, CoreMetrics.TEST_SUCCESS_DENSITY, ParsingUtils.scaleValue(percentage)); + } + saveResults(resource, report); + } - // Try with + in name - try { - context.saveMeasure(getUnitTestResource(className.replace('_', '+')), metric, value); - } catch (Exception e) { - // no-op - file was probably already registered successfully + protected void saveResults(Resource testFile, UnitTestClassReport report) { + for (UnitTestResult unitTestResult : report.getResults()) { + MutableTestPlan testPlan = perspectives.as(MutableTestPlan.class, testFile); + if (testPlan != null) { + testPlan.addTestCase(unitTestResult.getName()) + .setDurationInMs(Math.max(unitTestResult.getDurationMilliseconds(), 0)) + .setStatus(TestCase.Status.of(unitTestResult.getStatus())) + .setMessage(unitTestResult.getMessage()) + .setType(TestCase.TYPE_UNIT) + .setStackTrace(unitTestResult.getStackTrace()); } } } @@ -170,12 +178,11 @@ public Resource getUnitTestResource(String classname) { } /* - * Most xcodebuild JUnit parsers don't include the path to the class in the class field, so search for if it + * Most xcodebuild JUnit parsers don't include the path to the class in the class field, so search for it if it * wasn't found in the root. */ if (!file.isFile() || !file.exists()) { List files = ImmutableList.copyOf(fileSystem.files(fileSystem.predicates().and( - fileSystem.predicates().hasLanguage(ObjectiveC.KEY), fileSystem.predicates().hasType(InputFile.Type.TEST), fileSystem.predicates().matchesPathPattern("**/" + fileName)))); @@ -194,4 +201,10 @@ public Resource getUnitTestResource(String classname) { sonarFile.setQualifier(Qualifiers.UNIT_TEST_FILE); return sonarFile; } + + private void saveMeasure(Resource resource, Metric metric, double value) { + if (!Double.isNaN(value)) { + context.saveMeasure(resource, metric, value); + } + } } diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java b/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java index 555272d6..1dde4759 100644 --- a/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java @@ -26,6 +26,7 @@ import org.sonar.api.batch.Sensor; import org.sonar.api.batch.SensorContext; import org.sonar.api.batch.fs.FileSystem; +import org.sonar.api.component.ResourcePerspectives; import org.sonar.api.config.Settings; import org.sonar.api.resources.Project; import org.sonar.api.scan.filesystem.PathResolver; @@ -39,11 +40,14 @@ public final class SurefireSensor implements Sensor { private final FileSystem fileSystem; private final PathResolver pathResolver; + private final ResourcePerspectives resourcePerspectives; private final Settings settings; - public SurefireSensor(FileSystem fileSystem, PathResolver pathResolver, Settings settings) { + public SurefireSensor(FileSystem fileSystem, PathResolver pathResolver, ResourcePerspectives resourcePerspectives, + Settings settings) { this.fileSystem = fileSystem; this.pathResolver = pathResolver; + this.resourcePerspectives = resourcePerspectives; this.settings = settings; } @@ -67,7 +71,7 @@ public void analyse(Project project, SensorContext context) { protected void collect(Project project, SensorContext context, File reportsDir) { LOGGER.info("parsing {}", reportsDir); - new SurefireParser(project, context, fileSystem).collect(reportsDir); + new SurefireParser(fileSystem, project, resourcePerspectives, context).collect(reportsDir); } @Override diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/data/SurefireStaxHandler.java b/src/main/java/org/sonar/plugins/objectivec/surefire/data/SurefireStaxHandler.java new file mode 100644 index 00000000..ee6e7d62 --- /dev/null +++ b/src/main/java/org/sonar/plugins/objectivec/surefire/data/SurefireStaxHandler.java @@ -0,0 +1,143 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.plugins.objectivec.surefire.data; + +import org.apache.commons.lang.StringUtils; +import org.codehaus.staxmate.in.ElementFilter; +import org.codehaus.staxmate.in.SMEvent; +import org.codehaus.staxmate.in.SMHierarchicCursor; +import org.codehaus.staxmate.in.SMInputCursor; +import org.sonar.api.utils.ParsingUtils; +import org.sonar.api.utils.StaxParser.XmlStreamHandler; + +import javax.xml.stream.XMLStreamException; +import java.text.ParseException; +import java.util.Locale; + +public class SurefireStaxHandler implements XmlStreamHandler { + + private final UnitTestIndex index; + + public SurefireStaxHandler(UnitTestIndex index) { + this.index = index; + } + + @Override + public void stream(SMHierarchicCursor rootCursor) throws XMLStreamException { + SMInputCursor testSuite = rootCursor.constructDescendantCursor(new ElementFilter("testsuite")); + SMEvent testSuiteEvent; + for (testSuiteEvent = testSuite.getNext(); testSuiteEvent != null; testSuiteEvent = testSuite.getNext()) { + if (testSuiteEvent.compareTo(SMEvent.START_ELEMENT) == 0) { + String testSuiteClassName = testSuite.getAttrValue("name"); + if (StringUtils.contains(testSuiteClassName, "$")) { + // test suites for inner classes are ignored + return; + } + SMInputCursor testCase = testSuite.childCursor(new ElementFilter("testcase")); + SMEvent event; + for (event = testCase.getNext(); event != null; event = testCase.getNext()) { + if (event.compareTo(SMEvent.START_ELEMENT) == 0) { + String testClassName = getClassname(testCase, testSuiteClassName); + UnitTestClassReport classReport = index.index(testClassName); + parseTestCase(testCase, classReport); + } + } + } + } + } + + private static String getClassname(SMInputCursor testCaseCursor, + String defaultClassname) throws XMLStreamException { + String testClassName = testCaseCursor.getAttrValue("classname"); + if (StringUtils.isNotBlank(testClassName) && testClassName.endsWith(")")) { + testClassName = testClassName.substring(0, testClassName.indexOf("(")); + } + return StringUtils.defaultIfBlank(testClassName, defaultClassname); + } + + private static void parseTestCase(SMInputCursor testCaseCursor, + UnitTestClassReport report) throws XMLStreamException { + report.add(parseTestResult(testCaseCursor)); + } + + private static void setStackAndMessage(UnitTestResult result, + SMInputCursor stackAndMessageCursor) throws XMLStreamException { + result.setMessage(stackAndMessageCursor.getAttrValue("message")); + String stack = stackAndMessageCursor.collectDescendantText(); + result.setStackTrace(stack); + } + + private static UnitTestResult parseTestResult(SMInputCursor testCaseCursor) throws XMLStreamException { + UnitTestResult detail = new UnitTestResult(); + String name = getTestCaseName(testCaseCursor); + detail.setName(name); + + String status = UnitTestResult.STATUS_OK; + String time = testCaseCursor.getAttrValue("time"); + Long duration = null; + + SMInputCursor childNode = testCaseCursor.descendantElementCursor(); + if (childNode.getNext() != null) { + String elementName = childNode.getLocalName(); + if ("skipped".equals(elementName)) { + status = UnitTestResult.STATUS_SKIPPED; + // bug with surefire reporting wrong time for skipped tests + duration = 0L; + + } else if ("failure".equals(elementName)) { + status = UnitTestResult.STATUS_FAILURE; + setStackAndMessage(detail, childNode); + + } else if ("error".equals(elementName)) { + status = UnitTestResult.STATUS_ERROR; + setStackAndMessage(detail, childNode); + } + } + while (childNode.getNext() != null) { + // make sure we loop till the end of the elements cursor + } + if (duration == null) { + duration = getTimeAttributeInMS(time); + } + detail.setDurationMilliseconds(duration); + detail.setStatus(status); + return detail; + } + + private static long getTimeAttributeInMS(String value) throws XMLStreamException { + // hardcoded to Locale.ENGLISH see http://jira.codehaus.org/browse/SONAR-602 + try { + Double time = ParsingUtils.parseNumber(value, Locale.ENGLISH); + return !Double.isNaN(time) ? (long) ParsingUtils.scaleValue(time * 1000, 3) : 0L; + } catch (ParseException e) { + throw new XMLStreamException(e); + } + } + + private static String getTestCaseName(SMInputCursor testCaseCursor) throws XMLStreamException { + String classname = testCaseCursor.getAttrValue("classname"); + String name = testCaseCursor.getAttrValue("name"); + if (StringUtils.contains(classname, "$")) { + return StringUtils.substringAfter(classname, "$") + "/" + name; + } + return name; + } +} diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestClassReport.java b/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestClassReport.java new file mode 100644 index 00000000..8291486d --- /dev/null +++ b/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestClassReport.java @@ -0,0 +1,103 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.plugins.objectivec.surefire.data; + +import com.google.common.collect.Lists; + +import java.util.Collections; +import java.util.List; + +public final class UnitTestClassReport { + private long errors = 0L; + private long failures = 0L; + private long skipped = 0L; + private long tests = 0L; + private long durationMilliseconds = 0L; + + + private long negativeTimeTestNumber = 0L; + private List results = null; + + public UnitTestClassReport add(UnitTestClassReport other) { + for (UnitTestResult otherResult : other.getResults()) { + add(otherResult); + } + return this; + } + + public UnitTestClassReport add(UnitTestResult result) { + initResults(); + results.add(result); + if (result.getStatus().equals(UnitTestResult.STATUS_SKIPPED)) { + skipped += 1; + + } else if (result.getStatus().equals(UnitTestResult.STATUS_FAILURE)) { + failures += 1; + + } else if (result.getStatus().equals(UnitTestResult.STATUS_ERROR)) { + errors += 1; + } + tests += 1; + if (result.getDurationMilliseconds() < 0) { + negativeTimeTestNumber += 1; + } else { + durationMilliseconds += result.getDurationMilliseconds(); + } + return this; + } + + private void initResults() { + if (results == null) { + results = Lists.newArrayList(); + } + } + + public long getErrors() { + return errors; + } + + public long getFailures() { + return failures; + } + + public long getSkipped() { + return skipped; + } + + public long getTests() { + return tests; + } + + public long getDurationMilliseconds() { + return durationMilliseconds; + } + + public long getNegativeTimeTestNumber() { + return negativeTimeTestNumber; + } + + public List getResults() { + if (results == null) { + return Collections.emptyList(); + } + return results; + } +} diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestIndex.java b/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestIndex.java new file mode 100644 index 00000000..b6a9985c --- /dev/null +++ b/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestIndex.java @@ -0,0 +1,81 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.plugins.objectivec.surefire.data; + +import com.google.common.collect.Maps; +import com.google.common.collect.Sets; + +import java.util.Map; +import java.util.Set; + +/** + * @since 2.8 + */ +public class UnitTestIndex { + + private Map indexByClassname; + + public UnitTestIndex() { + this.indexByClassname = Maps.newHashMap(); + } + + public UnitTestClassReport index(String classname) { + UnitTestClassReport classReport = indexByClassname.get(classname); + if (classReport == null) { + classReport = new UnitTestClassReport(); + indexByClassname.put(classname, classReport); + } + return classReport; + } + + public UnitTestClassReport get(String classname) { + return indexByClassname.get(classname); + } + + public Set getClassnames() { + return Sets.newHashSet(indexByClassname.keySet()); + } + + public Map getIndexByClassname() { + return indexByClassname; + } + + public int size() { + return indexByClassname.size(); + } + + public UnitTestClassReport merge(String classname, String intoClassname) { + UnitTestClassReport from = indexByClassname.get(classname); + if (from!=null) { + UnitTestClassReport to = index(intoClassname); + to.add(from); + indexByClassname.remove(classname); + return to; + } + return null; + } + + public void remove(String classname) { + indexByClassname.remove(classname); + } + + +} \ No newline at end of file diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestResult.java b/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestResult.java new file mode 100644 index 00000000..fbe5b425 --- /dev/null +++ b/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestResult.java @@ -0,0 +1,87 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +package org.sonar.plugins.objectivec.surefire.data; + +public final class UnitTestResult { + public static final String STATUS_OK = "ok"; + public static final String STATUS_ERROR = "error"; + public static final String STATUS_FAILURE = "failure"; + public static final String STATUS_SKIPPED = "skipped"; + + private String name; + private String status; + private String stackTrace; + private String message; + private long durationMilliseconds = 0L; + + public String getName() { + return name; + } + + public UnitTestResult setName(String name) { + this.name = name; + return this; + } + + public String getStatus() { + return status; + } + + public UnitTestResult setStatus(String status) { + this.status = status; + return this; + } + + public String getStackTrace() { + return stackTrace; + } + + public UnitTestResult setStackTrace(String stackTrace) { + this.stackTrace = stackTrace; + return this; + } + + public String getMessage() { + return message; + } + + public UnitTestResult setMessage(String message) { + this.message = message; + return this; + } + + public long getDurationMilliseconds() { + return durationMilliseconds; + } + + public UnitTestResult setDurationMilliseconds(long l) { + this.durationMilliseconds = l; + return this; + } + + public boolean isErrorOrFailure() { + return STATUS_ERROR.equals(status) || STATUS_FAILURE.equals(status); + } + + public boolean isError() { + return STATUS_ERROR.equals(status); + } +} diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/data/package-info.java b/src/main/java/org/sonar/plugins/objectivec/surefire/data/package-info.java new file mode 100644 index 00000000..ca0cdbbb --- /dev/null +++ b/src/main/java/org/sonar/plugins/objectivec/surefire/data/package-info.java @@ -0,0 +1,24 @@ +/* + * Sonar Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, + * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio + * dev@sonar.codehaus.org + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + */ +@ParametersAreNonnullByDefault +package org.sonar.plugins.objectivec.surefire.data; + +import javax.annotation.ParametersAreNonnullByDefault; diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/package-info.java b/src/main/java/org/sonar/plugins/objectivec/surefire/package-info.java index 793c1666..9940bf31 100644 --- a/src/main/java/org/sonar/plugins/objectivec/surefire/package-info.java +++ b/src/main/java/org/sonar/plugins/objectivec/surefire/package-info.java @@ -21,4 +21,4 @@ @ParametersAreNonnullByDefault package org.sonar.plugins.objectivec.surefire; -import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file +import javax.annotation.ParametersAreNonnullByDefault; From 904c4986ecdee2d92c219954e6ab53734b9ee484 Mon Sep 17 00:00:00 2001 From: Matthew DeTullio Date: Tue, 3 Nov 2015 19:35:55 -0500 Subject: [PATCH 30/42] POM updates and update source headers --- pom.xml | 28 +++++-------------- .../objectivec/ObjectiveCAstScanner.java | 6 ++-- .../objectivec/ObjectiveCConfiguration.java | 6 ++-- .../objectivec/api/ObjectiveCGrammar.java | 6 ++-- .../objectivec/api/ObjectiveCKeyword.java | 6 ++-- .../objectivec/api/ObjectiveCMetric.java | 6 ++-- .../objectivec/api/ObjectiveCPunctuator.java | 6 ++-- .../objectivec/api/ObjectiveCTokenType.java | 6 ++-- .../sonar/objectivec/api/package-info.java | 6 ++-- .../sonar/objectivec/checks/CheckList.java | 6 ++-- .../sonar/objectivec/checks/package-info.java | 6 ++-- .../objectivec/lexer/ObjectiveCLexer.java | 6 ++-- .../sonar/objectivec/lexer/package-info.java | 6 ++-- .../org/sonar/objectivec/package-info.java | 6 ++-- .../parser/ObjectiveCGrammarImpl.java | 6 ++-- .../objectivec/parser/ObjectiveCParser.java | 6 ++-- .../sonar/objectivec/parser/package-info.java | 6 ++-- .../sonar/plugins/objectivec/ObjectiveC.java | 6 ++-- .../objectivec/ObjectiveCColorizerFormat.java | 6 ++-- .../objectivec/ObjectiveCCpdMapping.java | 6 ++-- .../plugins/objectivec/ObjectiveCPlugin.java | 6 ++-- .../plugins/objectivec/ObjectiveCProfile.java | 6 ++-- .../objectivec/ObjectiveCSquidSensor.java | 6 ++-- .../objectivec/ObjectiveCTokenizer.java | 6 ++-- .../objectivec/clang/ClangPlistParser.java | 6 ++-- .../objectivec/clang/ClangProfile.java | 6 ++-- .../clang/ClangProfileImporter.java | 6 ++-- .../clang/ClangRulesDefinition.java | 6 ++-- .../plugins/objectivec/clang/ClangSensor.java | 6 ++-- .../objectivec/clang/ClangWarning.java | 6 ++-- .../objectivec/clang/package-info.java | 6 ++-- .../cobertura/CoberturaReportParser.java | 6 ++-- .../objectivec/cobertura/CoberturaSensor.java | 6 ++-- .../objectivec/cobertura/package-info.java | 6 ++-- .../objectivec/lizard/LizardReportParser.java | 6 ++-- .../objectivec/lizard/LizardSensor.java | 6 ++-- .../objectivec/lizard/package-info.java | 6 ++-- .../objectivec/oclint/OCLintParser.java | 6 ++-- .../objectivec/oclint/OCLintProfile.java | 6 ++-- .../oclint/OCLintProfileImporter.java | 6 ++-- .../oclint/OCLintRulesDefinition.java | 6 ++-- .../objectivec/oclint/OCLintSensor.java | 6 ++-- .../objectivec/oclint/package-info.java | 6 ++-- .../plugins/objectivec/package-info.java | 6 ++-- .../objectivec/surefire/SurefireParser.java | 6 ++-- .../objectivec/surefire/SurefireSensor.java | 6 ++-- .../surefire/data/SurefireStaxHandler.java | 6 ++-- .../surefire/data/UnitTestClassReport.java | 6 ++-- .../surefire/data/UnitTestIndex.java | 6 ++-- .../surefire/data/UnitTestResult.java | 6 ++-- .../surefire/data/package-info.java | 6 ++-- .../objectivec/surefire/package-info.java | 6 ++-- .../objectivec/ObjectiveCAstScannerTest.java | 6 ++-- .../api/ObjectiveCPunctuatorTest.java | 6 ++-- .../objectivec/lexer/ObjectiveCLexerTest.java | 6 ++-- .../lizard/LizardReportParserTest.java | 6 ++-- .../objectivec/oclint/ProjectBuilder.java | 6 ++-- 57 files changed, 175 insertions(+), 189 deletions(-) diff --git a/pom.xml b/pom.xml index 5d58e063..1bf6f2a9 100644 --- a/pom.xml +++ b/pom.xml @@ -2,34 +2,19 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> 4.0.0 - - - sonar - http://repository.sonarsource.org/content/repositories/sonar - - - - - - sonar - http://repository.sonarsource.org/content/repositories/sonar - - - - org.codehaus.sonar-plugins + org.sonarsource.parent parent - 18 + 23 org.codehaus.sonar-plugin.objectivec sonar-objective-c-plugin 0.5.0-SNAPSHOT - sonar-plugin - Objective-C Sonar Plugin - Enables analysis of Objective-C projects into Sonar. + SonarQube Objective-C Plugin + Enable analysis and reporting on Objective-C projects. https://github.com/octo-technology/sonar-objective-c @@ -100,10 +85,10 @@ - OCTO Technology, Backelite, + OCTO Technology, Backelite, SonarSource, Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - Sonar Objective-C Plugin + SonarQube Objective-C Plugin true @@ -121,6 +106,7 @@ org.codehaus.sonar sonar-plugin-api ${sonar.version} + provided org.codehaus.sonar.sslr diff --git a/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java b/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java index e885621e..e7f2b748 100644 --- a/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java +++ b/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java b/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java index 3a1dcc96..a94ab886 100644 --- a/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java +++ b/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/objectivec/api/ObjectiveCGrammar.java b/src/main/java/org/sonar/objectivec/api/ObjectiveCGrammar.java index e2a71d8e..f9b03acc 100644 --- a/src/main/java/org/sonar/objectivec/api/ObjectiveCGrammar.java +++ b/src/main/java/org/sonar/objectivec/api/ObjectiveCGrammar.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java b/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java index 69dbde33..9912353c 100644 --- a/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java +++ b/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java b/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java index 2c35c648..70455d92 100644 --- a/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java +++ b/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java b/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java index d8773a0f..03606a5f 100644 --- a/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java +++ b/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java b/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java index 04b790a8..1ac8cb66 100644 --- a/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java +++ b/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/objectivec/api/package-info.java b/src/main/java/org/sonar/objectivec/api/package-info.java index 2be084af..7e1b771e 100644 --- a/src/main/java/org/sonar/objectivec/api/package-info.java +++ b/src/main/java/org/sonar/objectivec/api/package-info.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/objectivec/checks/CheckList.java b/src/main/java/org/sonar/objectivec/checks/CheckList.java index 1248299f..a757ae8d 100644 --- a/src/main/java/org/sonar/objectivec/checks/CheckList.java +++ b/src/main/java/org/sonar/objectivec/checks/CheckList.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/objectivec/checks/package-info.java b/src/main/java/org/sonar/objectivec/checks/package-info.java index 3e6c7159..e153f9ef 100644 --- a/src/main/java/org/sonar/objectivec/checks/package-info.java +++ b/src/main/java/org/sonar/objectivec/checks/package-info.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java b/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java index fc735041..9da201b9 100644 --- a/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java +++ b/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/objectivec/lexer/package-info.java b/src/main/java/org/sonar/objectivec/lexer/package-info.java index b88cf03a..c69b45c1 100644 --- a/src/main/java/org/sonar/objectivec/lexer/package-info.java +++ b/src/main/java/org/sonar/objectivec/lexer/package-info.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/objectivec/package-info.java b/src/main/java/org/sonar/objectivec/package-info.java index 2b3ce472..195f5177 100644 --- a/src/main/java/org/sonar/objectivec/package-info.java +++ b/src/main/java/org/sonar/objectivec/package-info.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/objectivec/parser/ObjectiveCGrammarImpl.java b/src/main/java/org/sonar/objectivec/parser/ObjectiveCGrammarImpl.java index f924a421..adda79f1 100644 --- a/src/main/java/org/sonar/objectivec/parser/ObjectiveCGrammarImpl.java +++ b/src/main/java/org/sonar/objectivec/parser/ObjectiveCGrammarImpl.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java b/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java index cea79b60..7a56850f 100644 --- a/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java +++ b/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/objectivec/parser/package-info.java b/src/main/java/org/sonar/objectivec/parser/package-info.java index 394d483b..72983bee 100644 --- a/src/main/java/org/sonar/objectivec/parser/package-info.java +++ b/src/main/java/org/sonar/objectivec/parser/package-info.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java index 894bf4ed..bac72a09 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCColorizerFormat.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCColorizerFormat.java index 1feb1026..ef63b091 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCColorizerFormat.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCColorizerFormat.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCCpdMapping.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCCpdMapping.java index 010c2789..a8e810c7 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCCpdMapping.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCCpdMapping.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java index 7e3427b9..74307b0d 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCProfile.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCProfile.java index 4e6514ec..ac4ed0f3 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCProfile.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCProfile.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java index 625870b5..348cdcef 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCTokenizer.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCTokenizer.java index ef8aa835..e20c79c2 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCTokenizer.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveCTokenizer.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/clang/ClangPlistParser.java b/src/main/java/org/sonar/plugins/objectivec/clang/ClangPlistParser.java index 48b279cd..f1a9b575 100644 --- a/src/main/java/org/sonar/plugins/objectivec/clang/ClangPlistParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/clang/ClangPlistParser.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfile.java b/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfile.java index 5ff64831..1fe5201d 100644 --- a/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfile.java +++ b/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfile.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfileImporter.java b/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfileImporter.java index 3241fa02..fb843031 100644 --- a/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfileImporter.java +++ b/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfileImporter.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java b/src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java index dc9b2aaa..1eb4cda0 100644 --- a/src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java +++ b/src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/clang/ClangSensor.java b/src/main/java/org/sonar/plugins/objectivec/clang/ClangSensor.java index 37b2ddba..c0c1dbcc 100644 --- a/src/main/java/org/sonar/plugins/objectivec/clang/ClangSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/clang/ClangSensor.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/clang/ClangWarning.java b/src/main/java/org/sonar/plugins/objectivec/clang/ClangWarning.java index d7cd2534..53740c07 100644 --- a/src/main/java/org/sonar/plugins/objectivec/clang/ClangWarning.java +++ b/src/main/java/org/sonar/plugins/objectivec/clang/ClangWarning.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/clang/package-info.java b/src/main/java/org/sonar/plugins/objectivec/clang/package-info.java index 0ba04140..8bf64768 100644 --- a/src/main/java/org/sonar/plugins/objectivec/clang/package-info.java +++ b/src/main/java/org/sonar/plugins/objectivec/clang/package-info.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaReportParser.java b/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaReportParser.java index c8900506..2bf8eafc 100644 --- a/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaReportParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaReportParser.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaSensor.java b/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaSensor.java index ad84b738..75cc7edb 100644 --- a/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaSensor.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/cobertura/package-info.java b/src/main/java/org/sonar/plugins/objectivec/cobertura/package-info.java index 8c218598..61dccbb9 100644 --- a/src/main/java/org/sonar/plugins/objectivec/cobertura/package-info.java +++ b/src/main/java/org/sonar/plugins/objectivec/cobertura/package-info.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/lizard/LizardReportParser.java b/src/main/java/org/sonar/plugins/objectivec/lizard/LizardReportParser.java index a524b31a..16f1fc0c 100644 --- a/src/main/java/org/sonar/plugins/objectivec/lizard/LizardReportParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/lizard/LizardReportParser.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java b/src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java index 0bce156a..d817c3e0 100644 --- a/src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/lizard/package-info.java b/src/main/java/org/sonar/plugins/objectivec/lizard/package-info.java index 35a75a60..9ec785cf 100644 --- a/src/main/java/org/sonar/plugins/objectivec/lizard/package-info.java +++ b/src/main/java/org/sonar/plugins/objectivec/lizard/package-info.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintParser.java b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintParser.java index 78a369dd..c756273f 100644 --- a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintParser.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java index f896b24a..5f626b81 100644 --- a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java +++ b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfileImporter.java b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfileImporter.java index a4970402..f21b16e1 100644 --- a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfileImporter.java +++ b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfileImporter.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintRulesDefinition.java b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintRulesDefinition.java index ebf68057..ededbb89 100644 --- a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintRulesDefinition.java +++ b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintRulesDefinition.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintSensor.java b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintSensor.java index 0baaf444..05723e00 100644 --- a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintSensor.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/oclint/package-info.java b/src/main/java/org/sonar/plugins/objectivec/oclint/package-info.java index 3a365c43..1e36f16b 100644 --- a/src/main/java/org/sonar/plugins/objectivec/oclint/package-info.java +++ b/src/main/java/org/sonar/plugins/objectivec/oclint/package-info.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/package-info.java b/src/main/java/org/sonar/plugins/objectivec/package-info.java index ab3241c8..c9bc8f8b 100644 --- a/src/main/java/org/sonar/plugins/objectivec/package-info.java +++ b/src/main/java/org/sonar/plugins/objectivec/package-info.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java b/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java index 9e0726e8..26a5e5f4 100644 --- a/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java +++ b/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java b/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java index 1dde4759..cc26b368 100644 --- a/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java +++ b/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/data/SurefireStaxHandler.java b/src/main/java/org/sonar/plugins/objectivec/surefire/data/SurefireStaxHandler.java index ee6e7d62..983155de 100644 --- a/src/main/java/org/sonar/plugins/objectivec/surefire/data/SurefireStaxHandler.java +++ b/src/main/java/org/sonar/plugins/objectivec/surefire/data/SurefireStaxHandler.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestClassReport.java b/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestClassReport.java index 8291486d..0eb30f37 100644 --- a/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestClassReport.java +++ b/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestClassReport.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestIndex.java b/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestIndex.java index b6a9985c..a303ab8d 100644 --- a/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestIndex.java +++ b/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestIndex.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestResult.java b/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestResult.java index fbe5b425..4448f77f 100644 --- a/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestResult.java +++ b/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestResult.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/data/package-info.java b/src/main/java/org/sonar/plugins/objectivec/surefire/data/package-info.java index ca0cdbbb..c87279e7 100644 --- a/src/main/java/org/sonar/plugins/objectivec/surefire/data/package-info.java +++ b/src/main/java/org/sonar/plugins/objectivec/surefire/data/package-info.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/package-info.java b/src/main/java/org/sonar/plugins/objectivec/surefire/package-info.java index 9940bf31..fd228c49 100644 --- a/src/main/java/org/sonar/plugins/objectivec/surefire/package-info.java +++ b/src/main/java/org/sonar/plugins/objectivec/surefire/package-info.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/test/java/org/sonar/objectivec/ObjectiveCAstScannerTest.java b/src/test/java/org/sonar/objectivec/ObjectiveCAstScannerTest.java index 0125317f..cd8beebd 100644 --- a/src/test/java/org/sonar/objectivec/ObjectiveCAstScannerTest.java +++ b/src/test/java/org/sonar/objectivec/ObjectiveCAstScannerTest.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/test/java/org/sonar/objectivec/api/ObjectiveCPunctuatorTest.java b/src/test/java/org/sonar/objectivec/api/ObjectiveCPunctuatorTest.java index 625e816a..24818c34 100644 --- a/src/test/java/org/sonar/objectivec/api/ObjectiveCPunctuatorTest.java +++ b/src/test/java/org/sonar/objectivec/api/ObjectiveCPunctuatorTest.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java b/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java index 20d03f8c..1d2862df 100644 --- a/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java +++ b/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/test/java/org/sonar/plugins/objectivec/lizard/LizardReportParserTest.java b/src/test/java/org/sonar/plugins/objectivec/lizard/LizardReportParserTest.java index 2c9d9e7b..63a80d96 100644 --- a/src/test/java/org/sonar/plugins/objectivec/lizard/LizardReportParserTest.java +++ b/src/test/java/org/sonar/plugins/objectivec/lizard/LizardReportParserTest.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public diff --git a/src/test/java/org/sonar/plugins/objectivec/oclint/ProjectBuilder.java b/src/test/java/org/sonar/plugins/objectivec/oclint/ProjectBuilder.java index 1320dcaf..961ac070 100644 --- a/src/test/java/org/sonar/plugins/objectivec/oclint/ProjectBuilder.java +++ b/src/test/java/org/sonar/plugins/objectivec/oclint/ProjectBuilder.java @@ -1,8 +1,8 @@ /* - * Sonar Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, + * SonarQube Objective-C Plugin + * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * dev@sonar.codehaus.org + * sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public From 3c56c74d086bd8aafba8cf40a34e8be3dbab9f8e Mon Sep 17 00:00:00 2001 From: Matthew DeTullio Date: Tue, 3 Nov 2015 21:15:05 -0500 Subject: [PATCH 31/42] Get rid of the nasty shell script, update sample properites and README --- README.md | 186 +++++++++++---- sample/sonar-project.properties | 89 +++---- src/main/shell/run-sonar.sh | 319 -------------------------- src/test/shell/configuration.test | 36 --- src/test/shell/nominal.test | 369 ------------------------------ src/test/shell/usage.test | 34 --- 6 files changed, 190 insertions(+), 843 deletions(-) delete mode 100755 src/main/shell/run-sonar.sh delete mode 100644 src/test/shell/configuration.test delete mode 100644 src/test/shell/nominal.test delete mode 100644 src/test/shell/usage.test diff --git a/README.md b/README.md index 5387ac7b..250e3723 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,25 @@ -SonarQube Plugin for Objective C -================================ +# SonarQube Plugin for Objective-C -This repository hosts the Objective-C plugin for [SonarQube](http://www.sonarqube.org/). This plugin enables to analyze and track the quality of iOS (iPhone, iPad) and MacOS developments. +This repository hosts the Objective-C plugin for +[SonarQube](http://www.sonarqube.org/). This plugin aims to analyze and track +the quality of iOS (iPhone, iPad) and MacOS projects, but it can be used with +other Objective-C projects. -This plugin is not supported by SonarSource. SonarSource offers a [commercial SonarSource Objective-C plugin](http://www.sonarsource.com/products/plugins/languages/objective-c/) as well. Both plugins do not offer the same functionalities/support. +This plugin is not supported by SonarSource. SonarSource offers a +[commercial SonarSource Objective-C plugin](http://www.sonarsource.com/products/plugins/languages/objective-c/) +as well. The plugins do not offer the same features/support. -The development of this plugin has always been done thanks to the community. If you wish to contribute, check the [Contributing](https://github.com/octo-technology/sonar-objective-c/wiki/Contributing) wiki page. +The development of this plugin has always been done thanks to the community. +If you wish to contribute, check the +[Contributing](https://github.com/octo-technology/sonar-objective-c/wiki/Contributing) +wiki page. Find below an example of an iOS SonarQube dashboard:

Example iOS SonarQube dashboard

-###Features +## Features - [x] Complexity - [ ] Design @@ -22,61 +29,155 @@ Find below an example of an iOS SonarQube dashboard: - [x] Size - [x] Tests -For more details, see the list of [SonarQube metrics](https://github.com/octo-technology/sonar-objective-c/wiki/Features) implemented or pending. +For more details, see the list of +[SonarQube metrics](https://github.com/octo-technology/sonar-objective-c/wiki/Features) +implemented or pending. -###Compatibility + +## Compatibility - Use 0.3.x releases for SonarQube < 4.3 -- Use 0.4.x releases for SonarQube >= 4.3 (4.x and 5.x) +- Use 0.4.0 or later releases for SonarQube >= 4.3 (4.x and 5.x) + -###Download +## Download The latest version is the 0.4.0 and it's available [here](http://bit.ly/18A7OkE). The latest SonarQube 3.x release is the 0.3.1, and it's available [here](http://bit.ly/1fSwd5I). -You can also download the latest build of the plugin from [Cloudbees](https://rfelden.ci.cloudbees.com/job/sonar-objective-c/lastSuccessfulBuild/artifact/target/). +You can also download the latest build of the plugin from +[Cloudbees](https://rfelden.ci.cloudbees.com/job/sonar-objective-c/lastSuccessfulBuild/artifact/target/). -In the worst case, the Maven repository with all snapshots and releases is available here: http://repository-rfelden.forge.cloudbees.com/ +In the worst case, the Maven repository with all snapshots and releases is +available here: http://repository-rfelden.forge.cloudbees.com/ + + +## Prerequisites + +- A Mac with Xcode +- Optional: [Homebrew](http://brew.sh) for easier prerequisite installation +- [SonarQube](http://docs.codehaus.org/display/SONAR/Setup+and+Upgrade) +- [SonarQube Runner](http://docs.codehaus.org/display/SONAR/Installing+and+Configuring+SonarQube+Runner) (```brew install sonar-runner```) + +### JUnit + +Any of the following will produce JUnit XML reports for your project: + +- [xctool](https://github.com/facebook/xctool) (```brew install xctool```) + - This is actually a substitute for xcodebuild, so it will compile your app and run tests as part of the process + - Make sure the version of xctool you use is compatible with the version of Xcode you will be building with +- [xcpretty](https://github.com/supermarin/xcpretty) (```gem install xcpretty```) + - This will parse xcodebuild's output and prettify it, with the option of generating a JUnit XML report and/or JSON compilation database +- [ocunit2junit](https://github.com/ciryon/OCUnit2JUnit) (```gem install ocunit2junit```) + - This will parse xcodebuild's output and generate a JUnit XML report + + +### Coverage + +Run your tests with code coverage enabled, then run one of the following tools +to produce a Cobertura XML report which can be imported by this plugin. + +- With Xcode prior to version 7, use [gcovr](http://gcovr.com) to parse ```*.gcda``` and ```*.gcno``` files +- With Xcode 7 or greater, use [slather](https://github.com/venmo/slather) to parse the ```Coverage.profdata``` file + - Note: at time of writing, support for the ```*.profdata``` format has not been released, but can be installed by running ```gem install specific_install && gem specific_install -l https://github.com/viteinfinite/slather.git -b 61f00988e6ad65f817ba81b08533cf78615fff16``` + - Note: at time of writing, xctool is not capable of producing coverage data when using Xcode 7+ + + +### Clang + +[Clang Static Analyzer](http://clang-analyzer.llvm.org/) can produce Plist +reports which can be imported by this plugin. + +There are different ways to produce the reports, such as using Clang's +[scan-build](http://clang-analyzer.llvm.org/scan-build.html), however it's +probably easiest to use xcodebuild's ```analyze``` action. Xcodebuild will +invoke the analyzer with all the proper arguments and use any additional +analyzer configuration from your settings under ```*.xcodeproj```. By default, +it will produce the Plist reports this plugin needs. + + +### OCLint + +[OCLint](http://docs.oclint.org/en/dev/intro/installation.html) version 0.8.1 recommended +(```brew install https://gist.githubusercontent.com/TonyAnhTran/e1522b93853c5a456b74/raw/157549c7a77261e906fb88bc5606afd8bd727a73/oclint.rb```). +Use it to produce a PMD-formatted XML report that can be imported by this +plugin. -###Prerequisites -- a Mac with Xcode... -- [SonarQube](http://docs.codehaus.org/display/SONAR/Setup+and+Upgrade) and [SonarQube Runner](http://docs.codehaus.org/display/SONAR/Installing+and+Configuring+SonarQube+Runner) installed ([HomeBrew](http://brew.sh) installed and ```brew install sonar-runner```) -- [xctool](https://github.com/facebook/xctool) ([HomeBrew](http://brew.sh) installed and ```brew install xctool```). If you are using Xcode 6, make sure to update xctool (```brew upgrade xctool```) to a version > 0.2.2. -- [OCLint](http://docs.oclint.org/en/dev/intro/installation.html) installed. Version 0.8.1 recommended ([HomeBrew](http://brew.sh) installed and ```brew install https://gist.githubusercontent.com/TonyAnhTran/e1522b93853c5a456b74/raw/157549c7a77261e906fb88bc5606afd8bd727a73/oclint.rb```). -- [gcovr](http://gcovr.com) installed -- [lizard](https://github.com/terryyin/lizard) installed +### Complexity -###Installation (once for all your Objective-C projects) -- Install [the plugin](http://bit.ly/18A7OkE) through the Update Center (of SonarQube) or download it into the $SONARQUBE_HOME/extensions/plugins directory -- Copy [run-sonar.sh](https://rawgithub.com/octo-technology/sonar-objective-c/master/src/main/shell/run-sonar.sh) somewhere in your PATH -- Restart the SonarQube server. +Use [Lizard](https://github.com/terryyin/lizard) (```pip install lizard```) +to produce an XML report that can be imported by this plugin. -###Configuration (once per project) -- Copy [sonar-project.properties](https://rawgithub.com/octo-technology/sonar-objective-c/master/sample/sonar-project.properties) in your Xcode project root folder (along your .xcodeproj file) -- Edit the *sonar-project.properties* file to match your Xcode iOS/MacOS project -**The good news is that you don't have to modify your Xcode project to enable SonarQube!**. Ok, there might be one needed modification if you don't have a specific scheme for your test target, but that's all. +## Installation (once for all your Objective-C projects) -###Analysis -- Run the script ```run-sonar.sh``` in your Xcode project root folder +1. Install [the plugin](http://bit.ly/18A7OkE) through the Update Center (of SonarQube) or download it into the $SONARQUBE_HOME/extensions/plugins directory +2. Restart the SonarQube server. + + +## Configuration (once per project) + +Create a ```sonar-project.properties``` file defining some basic project +configuration and the location of the reports you want to import. + +The good news is that you don't have to modify your Xcode project to enable +SonarQube! Ok, there might be needed modification if you don't have a +specific scheme for your test target or if coverage is not enabled, but that's all. + + +## Analysis + +- Run your build script to produce the various reports +- Run ```sonar-runner``` - Enjoy or file an issue! -###Update (once per plugin update) + +## Troubleshooting + +If the results from a report don't show up, make sure any relative file or +directory paths in the report match the paths of the files as configured +and indexed by SonarQube. Typically files are indexed relative to the base +directory of the project/module being analyzed. + +For JUnit reports, most tools only record the classname, so make sure your +```*.m``` file is named the same as the classname it contains. Otherwise, the +plugin won't be able to find the test class. + + +## Update + - Install the [latest plugin](http://bit.ly/18A7OkE) version -- Copy [run-sonar.sh](https://rawgithub.com/octo-technology/sonar-objective-c/master/src/main/shell/run-sonar.sh) somewhere in your PATH +- Check for documented migration steps + +### Migration to v0.5.x + +- Analysis property names have changed. Check the sample. +- Cobertura, JUnit, OCLint, and Lizard report properties no longer have defaults +- Coverage report property no longer supports pattern matching. Only one coverage XML file is supported. +- ```sonar.language``` key changed from ```objc``` to ```objectivec``` + - As a side effect you may have to reconfigure your Quality Profiles -If you still have *run-sonar.sh* file in each of your project (not recommended), you will need to update all those files. -###Credits -* **Cyril Picat** -* **Gilles Grousset** -* **Denis Bregeon** -* **François Helg** -* **Romain Felden** -* **Mete Balci** +## Contributors -###History +- Cyril Picat +- Gilles Grousset +- Denis Bregeon +- François Helg +- Romain Felden +- Mete Balci +- Andrés Gil Herrera +- Matthew DeTullio + + +## History + +- v0.5.0 (2015/11): + - added support for Clang + - made properties configurable in SonarQube UI + - major refactoring + - decouple report imports from the language so they can also be used with the commercial plugin - v0.4.1 (2015/05): added support for Lizard to implement complexity metrics. - v0.4.0 (2015/01): support for SonarQube >= 4.3 (4.x & 5.x) - v0.3.1 (2013/10): fix release @@ -84,7 +185,8 @@ If you still have *run-sonar.sh* file in each of your project (not recommended), - v0.2 (2013/10): added OCLint checks as SonarQube violations - v0.0.1 (2012/09): v0 with basic metrics such as nb lines of code, nb lines of comment, nb of files, duplications -###License -SonarQube Plugin for Objective C is released under the GNU LGPL 3 license: +## License + +SonarQube Plugin for Objective-C is released under the GNU LGPL 3 license: http://www.gnu.org/licenses/lgpl.txt diff --git a/sample/sonar-project.properties b/sample/sonar-project.properties index 58797447..dd3261f4 100644 --- a/sample/sonar-project.properties +++ b/sample/sonar-project.properties @@ -1,60 +1,63 @@ -########################## -# Required configuration # -########################## - -sonar.projectKey=my-project +# Required +sonar.projectKey=com.example:my-project +# Required sonar.projectName=My project +# Required sonar.projectVersion=1.0 -sonar.language=objc - -# Project description + +# Optional sonar.projectDescription=Fake description - -# Path to source directories + +# Required +# Path to source directories sonar.sources=srcDir1,srcDir2 -# Path to test directories (comment if no test) + +# Optional +sonar.inclusions=subDir1/**,subDir2/** +# Optional +sonar.exclusions=**/generatedDir/**,**/thirdpartyDir/** + +# Optional +# Path to test directories sonar.tests=testSrcDir - -# Xcode project configuration (.xcodeproj or .xcworkspace) -# -> If you have a project: configure only sonar.objectivec.project -# -> If you have a workspace: configure sonar.objectivec.workspace and sonar.objectivec.project -# and use the later to specify which project(s) to include in the analysis (comma separated list) -sonar.objectivec.project=myApplication.xcodeproj -# sonar.objectivec.workspace=myApplication.xcworkspace - -# Scheme to build your application -sonar.objectivec.appScheme=myApplication -# Scheme to build and run your tests (comment following line of you don't have any tests) -sonar.objectivec.testScheme=myApplicationTests - -########################## -# Optional configuration # -########################## +# Optional +sonar.test.inclusions=subDir3/** +# Optional +sonar.test.exclusions= + +# Recommended +# Add language property to limit to single-language analysis +sonar.language=objectivec + +# Define suffixes for multi-language analysis +# There will likely be problems if you have any other C/C++/Obj-C plugin(s) installed due to each language using .h files +sonar.objectivec.file.suffixes=.h,.m # Encoding of the source code sonar.sourceEncoding=UTF-8 -# JUnit report generated by run-sonar.sh is stored in sonar-reports/TEST-report.xml -# Change it only if you generate the file on your own -# The XML files have to be prefixed by TEST- otherwise they are not processed -# sonar.junit.reportsPath=sonar-reports/ +# Optional +# Folder with JUnit XML reports matching format of "TEST*.xml" +# Generate this with xctool, xcpretty, or ocunit2junit +sonar.objectivec.junit.reportsPath=sonar-reports/junit -# Cobertura report generated by run-sonar.sh is stored in sonar-reports/coverage.xml -# Change it only if you generate the file on your own -# sonar.objectivec.coverage.reportPattern=sonar-reports/coverage*.xml +# Optional +# Path to Cobertura XML report +# Generate this with gcovr (Xcode < 7) or slather (Xcode >= 7) +sonar.objectivec.cobertura.reportPath=sonar-reports/cobertura.xml -# OCLint report generated by run-sonar.sh is stored in sonar-reports/oclint.xml -# Change it only if you generate the file on your own -# sonar.objectivec.oclint.report=sonar-reports/oclint.xml +# Optional +# Path to OCLint PMD formatted XML report +sonar.objectivec.oclint.reportPath=sonar-reports/oclint.xml -# Lizard report generated by run-sonar.sh is stored in sonar-reports/lizard-report.xml -# Change it only if you generate the file on your own -# sonar.objectivec.lizard.report=sonar-reports/lizard-report.xml +# Optional +# Folder with Clang Plist reports matching format of "*.plist" +sonar.objectivec.clang.reportsPath=sonar-reports/clang -# Paths to exclude from coverage report (tests, 3rd party libraries etc.) -# sonar.objectivec.excludedPathsFromCoverage=pattern1,pattern2 -sonar.objectivec.excludedPathsFromCoverage=.*Tests.* +# Optional +# Path to Lizard XML report +sonar.objectivec.lizard.reportPath=sonar-reports/lizard.xml # Project SCM settings # sonar.scm.enabled=true diff --git a/src/main/shell/run-sonar.sh b/src/main/shell/run-sonar.sh deleted file mode 100755 index cd7f8ee6..00000000 --- a/src/main/shell/run-sonar.sh +++ /dev/null @@ -1,319 +0,0 @@ -#!/bin/bash -## INSTALLATION: script to copy in your Xcode project in the same directory as the .xcodeproj file -## USAGE: ./run-sonar.sh -## DEBUG: ./run-sonar.sh -v -## WARNING: edit your project parameters in sonar-project.properties rather than modifying this script -# - -trap "echo 'Script interrupted by Ctrl+C'; stopProgress; exit 1" SIGHUP SIGINT SIGTERM - -function startProgress() { - while true - do - echo -n "." - sleep 5 - done -} - -function stopProgress() { - if [ "$vflag" = "" -a "$nflag" = "" ]; then - kill $PROGRESS_PID &>/dev/null - fi -} - -function testIsInstalled() { - - hash $1 2>/dev/null - if [ $? -eq 1 ]; then - echo >&2 "ERROR - $1 is not installed or not in your PATH"; exit 1; - fi -} - -function readParameter() { - - variable=$1 - shift - parameter=$1 - shift - - eval $variable="\"$(sed '/^\#/d' sonar-project.properties | grep $parameter | tail -n 1 | cut -d '=' -f2- | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')\"" -} - -# Run a set of commands with logging and error handling -function runCommand() { - - # 1st arg: redirect stdout - # 2nd arg: command to run - # 3rd..nth arg: args - redirect=$1 - shift - - command=$1 - shift - - if [ "$nflag" = "on" ]; then - # don't execute command, just echo it - echo - if [ "$redirect" = "/dev/stdout" ]; then - if [ "$vflag" = "on" ]; then - echo "+" $command "$@" - else - echo "+" $command "$@" "> /dev/null" - fi - elif [ "$redirect" != "no" ]; then - echo "+" $command "$@" "> $redirect" - else - echo "+" $command "$@" - fi - - elif [ "$vflag" = "on" ]; then - echo - - if [ "$redirect" = "/dev/stdout" ]; then - set -x #echo on - $command "$@" - returnValue=$? - set +x #echo off - elif [ "$redirect" != "no" ]; then - set -x #echo on - $command "$@" > $redirect - returnValue=$? - set +x #echo off - else - set -x #echo on - $command "$@" - returnValue=$? - set +x #echo off - fi - - if [[ $returnValue != 0 && $returnValue != 5 ]] ; then - stopProgress - echo "ERROR - Command '$command $@' failed with error code: $returnValue" - exit $returnValue - fi - else - - if [ "$redirect" = "/dev/stdout" ]; then - $command "$@" > /dev/null - elif [ "$redirect" != "no" ]; then - $command "$@" > $redirect - else - $command "$@" - fi - - returnValue=$? - if [[ $returnValue != 0 && $returnValue != 5 ]] ; then - stopProgress - echo "ERROR - Command '$command $@' failed with error code: $returnValue" - exit $? - fi - - - echo - fi -} - -## COMMAND LINE OPTIONS -vflag="" -nflag="" -oclint="on" -lizard="on" -while [ $# -gt 0 ] -do - case "$1" in - -v) vflag=on;; - -n) nflag=on;; - -nooclint) oclint="";; - --) shift; break;; - -*) - echo >&2 "Usage: $0 [-v]" - exit 1;; - *) break;; # terminate while loop - esac - shift -done - -# Usage OK -echo "Running run-sonar.sh..." - -## CHECK PREREQUISITES - -# xctool, gcovr and oclint installed -testIsInstalled xctool -testIsInstalled gcovr -testIsInstalled oclint - -# sonar-project.properties in current directory -if [ ! -f sonar-project.properties ]; then - echo >&2 "ERROR - No sonar-project.properties in current directory"; exit 1; -fi - -## READ PARAMETERS from sonar-project.properties - -# Your .xcworkspace/.xcodeproj filename -workspaceFile=''; readParameter workspaceFile 'sonar.objectivec.workspace' -projectFile=''; readParameter projectFile 'sonar.objectivec.project' -if [[ "$workspaceFile" != "" ]] ; then - xctoolCmdPrefix="xctool -workspace $workspaceFile -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO" -else - xctoolCmdPrefix="xctool -project $projectFile -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO" -fi - -# Source directories for .h/.m files -srcDirs=''; readParameter srcDirs 'sonar.sources' -# The name of your application scheme in Xcode -appScheme=''; readParameter appScheme 'sonar.objectivec.appScheme' - -# The name of your test scheme in Xcode -testScheme=''; readParameter testScheme 'sonar.objectivec.testScheme' -# The file patterns to exclude from coverage report -excludedPathsFromCoverage=''; readParameter excludedPathsFromCoverage 'sonar.objectivec.excludedPathsFromCoverage' - -# Check for mandatory parameters -if [ -z "$projectFile" -o "$projectFile" = " " ]; then - - if [ ! -z "$workspaceFile" -a "$workspaceFile" != " " ]; then - echo >&2 "ERROR - sonar.objectivec.project parameter is missing in sonar-project.properties. You must specify which projects (comma-separated list) are application code within the workspace $workspaceFile." - else - echo >&2 "ERROR - sonar.objectivec.project parameter is missing in sonar-project.properties (name of your .xcodeproj)" - fi - exit 1 -fi -if [ -z "$srcDirs" -o "$srcDirs" = " " ]; then - echo >&2 "ERROR - sonar.sources parameter is missing in sonar-project.properties. You must specify which directories contain your .h/.m source files (comma-separated list)." - exit 1 -fi -if [ -z "$appScheme" -o "$appScheme" = " " ]; then - echo >&2 "ERROR - sonar.objectivec.appScheme parameter is missing in sonar-project.properties. You must specify which scheme is used to build your application." - exit 1 -fi - -if [ "$vflag" = "on" ]; then - echo "Xcode workspace file is: $workspaceFile" - echo "Xcode project file is: $projectFile" - echo "Xcode application scheme is: $appScheme" - echo "Xcode test scheme is: $testScheme" - echo "Excluded paths from coverage are: $excludedPathsFromCoverage" -fi - -## SCRIPT - -# Start progress indicator in the background -if [ "$vflag" = "" -a "$nflag" = "" ]; then - startProgress & - # Save PID - PROGRESS_PID=$! -fi - -# Create sonar-reports/ for reports output -if [[ ! (-d "sonar-reports") && ("$nflag" != "on") ]]; then - if [ "$vflag" = "on" ]; then - echo 'Creating directory sonar-reports/' - fi - mkdir sonar-reports - if [[ $? != 0 ]] ; then - stopProgress - exit $? - fi -fi - -# Extracting project information needed later -echo -n 'Extracting Xcode project information' -runCommand /dev/stdout $xctoolCmdPrefix -scheme "$appScheme" clean -runCommand /dev/stdout $xctoolCmdPrefix -scheme "$appScheme" -reporter json-compilation-database:compile_commands.json build - -# Unit tests and coverage -if [ "$testScheme" = "" ]; then - echo 'Skipping tests as no test scheme has been provided!' - - # Put default xml files with no tests and no coverage... - echo "" > sonar-reports/TEST-report.xml - echo "" > sonar-reports/coverage.xml -else - - echo -n 'Running tests using xctool' - runCommand sonar-reports/TEST-report.xml $xctoolCmdPrefix -scheme "$testScheme" -reporter junit GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES test - - echo -n 'Computing coverage report' - - # We do it for every xcodeproject (in case of workspaces) - - # Extract the path to the .gcno/.gcda coverage files - echo $projectFile | sed -n 1'p' | tr ',' '\n' > tmpFileRunSonarSh - while read projectName; do - - coverageFilesPath=$(grep 'command' compile_commands.json | sed 's#^.*-o \\/#\/#;s#",##' | grep "${projectName%%.*}.build" | awk 'NR<2' | sed 's/\\\//\//g' | sed 's/\\\\//g' | xargs -0 dirname) - if [ "$vflag" = "on" ]; then - echo - echo "Path for .gcno/.gcda coverage files is: $coverageFilesPath" - fi - - # Build the --exclude flags - excludedCommandLineFlags="" - if [ ! -z "$excludedPathsFromCoverage" -a "$excludedPathsFromCoverage" != " " ]; then - echo $excludedPathsFromCoverage | sed -n 1'p' | tr ',' '\n' > tmpFileRunSonarSh2 - while read word; do - excludedCommandLineFlags+=" --exclude $word" - done < tmpFileRunSonarSh2 - rm -rf tmpFileRunSonarSh2 - fi - if [ "$vflag" = "on" ]; then - echo "Command line exclusion flags for gcovr is:$excludedCommandLineFlags" - fi - - # Run gcovr with the right options - runCommand "sonar-reports/coverage-${projectName%%.*}.xml" gcovr -r . "$coverageFilesPath" $excludedCommandLineFlags --xml - - done < tmpFileRunSonarSh - rm -rf tmpFileRunSonarSh - -fi - -if [ "$oclint" = "on" ]; then - - # OCLint - echo -n 'Running OCLint...' - - # Build the --include flags - currentDirectory=${PWD##*/} - includedCommandLineFlags="" - echo "$srcDirs" | sed -n 1'p' | tr ',' '\n' > tmpFileRunSonarSh - while read word; do - includedCommandLineFlags+=" --include .*/${currentDirectory}/${word}" - done < tmpFileRunSonarSh - rm -rf tmpFileRunSonarSh - if [ "$vflag" = "on" ]; then - echo - echo -n "Path included in oclint analysis is:$includedCommandLineFlags" - fi - - # Run OCLint with the right set of compiler options - maxPriority=10000 - runCommand no oclint-json-compilation-database $includedCommandLineFlags -- -max-priority-1 $maxPriority -max-priority-2 $maxPriority -max-priority-3 $maxPriority -report-type pmd -o sonar-reports/oclint.xml -else - echo 'Skipping OCLint (test purposes only!)' -fi - -if [ "$lizard" = "on" ]; then - if hash lizard 2>/dev/null; then - # Lizard - echo -n 'Running Lizard...' - - # Run Lizard with xml output option and write the output in sonar-reports/lizard-report.xml - lizard --xml "$srcDirs" > sonar-reports/lizard-report.xml - else - echo 'Skipping Lizard (not installed!)' - fi - -else - echo 'Skipping Lizard (test purposes only!)' -fi - -# SonarQube -echo -n 'Running SonarQube using SonarQube Runner' -runCommand /dev/stdout sonar-runner - -# Kill progress indicator -stopProgress - -exit 0 diff --git a/src/test/shell/configuration.test b/src/test/shell/configuration.test deleted file mode 100644 index e313ee4d..00000000 --- a/src/test/shell/configuration.test +++ /dev/null @@ -1,36 +0,0 @@ -# 1. Missing sonar.sources parameter -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -v -n -<<< -sonar.objectivec.project=Application.xcodeproj -sonar.objectivec.appScheme=Application ->>>2 -ERROR - sonar.sources parameter is missing in sonar-project.properties. You must specify which directories contain your .h/.m source files (comma-separated list). ->>>= !0 - -# 2. Missing sonar.objectivec.project parameter (no workspace) -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -v -n -<<< -sonar.sources=src -sonar.objectivec.appScheme=Application ->>>2 -ERROR - sonar.objectivec.project parameter is missing in sonar-project.properties (name of your .xcodeproj) ->>>= !0 - -# 3. Missing sonar.objectivec.project parameter (w/ workspace) -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -v -n -<<< -sonar.sources=src -sonar.objectivec.workspace=Application.xcworkspace -sonar.objectivec.appScheme=Application ->>>2 -ERROR - sonar.objectivec.project parameter is missing in sonar-project.properties. You must specify which projects (comma-separated list) are application code within the workspace Application.xcworkspace. ->>>= !0 - -# 4. Missing sonar.objectivec.appScheme parameter -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -v -n -<<< -sonar.sources=src -sonar.objectivec.project=Application.xcodeproj ->>>2 -ERROR - sonar.objectivec.appScheme parameter is missing in sonar-project.properties. You must specify which scheme is used to build your application. ->>>= !0 diff --git a/src/test/shell/nominal.test b/src/test/shell/nominal.test deleted file mode 100644 index 96f330d2..00000000 --- a/src/test/shell/nominal.test +++ /dev/null @@ -1,369 +0,0 @@ -# 0. Setup default compile_commands.json -tee compile_commands.json | cat > /dev/null -<<< -[ - { - "command" : "blablabla -o \/Users\/user\/Library\/Developer\/Xcode\/DerivedData\/myApplication-hevorauelspmmeblhdabohacuurg\/Build\/Intermediates\/Application.build\/Debug-iphonesimulator\/Application.build\/Objects-normal\/i386\/myFile.o", - "directory" : "titi", - "file" : "myFile.m" - } -] ->>>= 0 - -# 1. Nominal file -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -v -n -<<< -sonar.sources=src -sonar.objectivec.project=Application.xcodeproj -sonar.objectivec.appScheme=Application -sonar.objectivec.testScheme=ApplicationTests -sonar.objectivec.excludedPathsFromCoverage=.*Tests.*,.*3rdParty.* ->>> -Running run-sonar.sh... -Xcode workspace file is: -Xcode project file is: Application.xcodeproj -Xcode application scheme is: Application -Xcode test scheme is: ApplicationTests -Excluded paths from coverage are: .*Tests.*,.*3rdParty.* -Extracting Xcode project information -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application clean - -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application -reporter json-compilation-database:compile_commands.json build -Running tests using xctool -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme ApplicationTests -reporter junit GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES test > sonar-reports/TEST-report.xml -Computing coverage report -Path for .gcno/.gcda coverage files is: /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application.build/Debug-iphonesimulator/Application.build/Objects-normal/i386 -Command line exclusion flags for gcovr is: --exclude .*Tests.* --exclude .*3rdParty.* - -+ gcovr -r . /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application.build/Debug-iphonesimulator/Application.build/Objects-normal/i386 --exclude .*Tests.* --exclude .*3rdParty.* --xml > sonar-reports/coverage-Application.xml -Running OCLint... -Path included in oclint analysis is: --include .*/shell/src.* -+ oclint-json-compilation-database --include .*/shell/src.* -- -report-type pmd -o sonar-reports/oclint.xml -Running SonarQube using SonarQube Runner -+ sonar-runner ->>>= 0 - -# 1bis. Nominal file not verbose -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -n -<<< -sonar.sources=src -sonar.objectivec.project=Application.xcodeproj -sonar.objectivec.appScheme=Application -sonar.objectivec.testScheme=ApplicationTests -sonar.objectivec.excludedPathsFromCoverage=.*Tests.*,.*3rdParty.* ->>> -Running run-sonar.sh... -Extracting Xcode project information -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application clean > /dev/null - -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application -reporter json-compilation-database:compile_commands.json build > /dev/null -Running tests using xctool -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme ApplicationTests -reporter junit GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES test > sonar-reports/TEST-report.xml -Computing coverage report -+ gcovr -r . /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application.build/Debug-iphonesimulator/Application.build/Objects-normal/i386 --exclude .*Tests.* --exclude .*3rdParty.* --xml > sonar-reports/coverage-Application.xml -Running OCLint... -+ oclint-json-compilation-database --include .*/shell/src.* -- -report-type pmd -o sonar-reports/oclint.xml -Running SonarQube using SonarQube Runner -+ sonar-runner > /dev/null ->>>= 0 - -# 2. Testing various spaces in filenames, schemes etc. -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -v -n -<<< -sonar.sources=src -sonar.objectivec.project=my Application.xcodeproj -sonar.objectivec.appScheme=my Application -sonar.objectivec.testScheme=Application tests -sonar.objectivec.excludedPathsFromCoverage=.*Tests.*,.*3rd Party.* ->>> -Running run-sonar.sh... -Xcode workspace file is: -Xcode project file is: my Application.xcodeproj -Xcode application scheme is: my Application -Xcode test scheme is: Application tests -Excluded paths from coverage are: .*Tests.*,.*3rd Party.* -Extracting Xcode project information -+ xctool -project my Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme my Application clean - -+ xctool -project my Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme my Application -reporter json-compilation-database:compile_commands.json build -Running tests using xctool -+ xctool -project my Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application tests -reporter junit GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES test > sonar-reports/TEST-report.xml -Computing coverage report -Path for .gcno/.gcda coverage files is: -Command line exclusion flags for gcovr is: --exclude .*Tests.* --exclude .*3rd Party.* - -+ gcovr -r . --exclude .*Tests.* --exclude .*3rd Party.* --xml > sonar-reports/coverage-my Application.xml -Running OCLint... -Path included in oclint analysis is: --include .*/shell/src.* -+ oclint-json-compilation-database --include .*/shell/src.* -- -report-type pmd -o sonar-reports/oclint.xml -Running SonarQube using SonarQube Runner -+ sonar-runner ->>>= 0 - -# 3. Testing usage of a Xcode workspace -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -v -n -<<< -sonar.sources=src -sonar.objectivec.workspace=Application.xcworkspace -sonar.objectivec.project=Application.xcodeproj -sonar.objectivec.appScheme=Application -sonar.objectivec.testScheme=ApplicationTests -sonar.objectivec.excludedPathsFromCoverage=.*Tests.*,.*3rdParty.* ->>> -Running run-sonar.sh... -Xcode workspace file is: Application.xcworkspace -Xcode project file is: Application.xcodeproj -Xcode application scheme is: Application -Xcode test scheme is: ApplicationTests -Excluded paths from coverage are: .*Tests.*,.*3rdParty.* -Extracting Xcode project information -+ xctool -workspace Application.xcworkspace -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application clean - -+ xctool -workspace Application.xcworkspace -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application -reporter json-compilation-database:compile_commands.json build -Running tests using xctool -+ xctool -workspace Application.xcworkspace -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme ApplicationTests -reporter junit GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES test > sonar-reports/TEST-report.xml -Computing coverage report -Path for .gcno/.gcda coverage files is: /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application.build/Debug-iphonesimulator/Application.build/Objects-normal/i386 -Command line exclusion flags for gcovr is: --exclude .*Tests.* --exclude .*3rdParty.* - -+ gcovr -r . /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application.build/Debug-iphonesimulator/Application.build/Objects-normal/i386 --exclude .*Tests.* --exclude .*3rdParty.* --xml > sonar-reports/coverage-Application.xml -Running OCLint... -Path included in oclint analysis is: --include .*/shell/src.* -+ oclint-json-compilation-database --include .*/shell/src.* -- -report-type pmd -o sonar-reports/oclint.xml -Running SonarQube using SonarQube Runner -+ sonar-runner ->>>= 0 - -# 4. Testing usage of multiple source directories -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -v -n -<<< -sonar.sources=src1,src2 -sonar.objectivec.project=Application.xcodeproj -sonar.objectivec.appScheme=Application -sonar.objectivec.testScheme=ApplicationTests -sonar.objectivec.excludedPathsFromCoverage=.*Tests.*,.*3rdParty.* ->>> -Running run-sonar.sh... -Xcode workspace file is: -Xcode project file is: Application.xcodeproj -Xcode application scheme is: Application -Xcode test scheme is: ApplicationTests -Excluded paths from coverage are: .*Tests.*,.*3rdParty.* -Extracting Xcode project information -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application clean - -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application -reporter json-compilation-database:compile_commands.json build -Running tests using xctool -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme ApplicationTests -reporter junit GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES test > sonar-reports/TEST-report.xml -Computing coverage report -Path for .gcno/.gcda coverage files is: /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application.build/Debug-iphonesimulator/Application.build/Objects-normal/i386 -Command line exclusion flags for gcovr is: --exclude .*Tests.* --exclude .*3rdParty.* - -+ gcovr -r . /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application.build/Debug-iphonesimulator/Application.build/Objects-normal/i386 --exclude .*Tests.* --exclude .*3rdParty.* --xml > sonar-reports/coverage-Application.xml -Running OCLint... -Path included in oclint analysis is: --include .*/shell/src1.* --include .*/shell/src2.* -+ oclint-json-compilation-database --include .*/shell/src1.* --include .*/shell/src2.* -- -report-type pmd -o sonar-reports/oclint.xml -Running SonarQube using SonarQube Runner -+ sonar-runner ->>>= 0 - -# x. Testing usage of -nooclint -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -v -n -nooclint -<<< -sonar.sources=src -sonar.objectivec.project=Application.xcodeproj -sonar.objectivec.appScheme=Application -sonar.objectivec.testScheme=ApplicationTests -sonar.objectivec.excludedPathsFromCoverage=.*Tests.*,.*3rdParty.* ->>> -Running run-sonar.sh... -Xcode workspace file is: -Xcode project file is: Application.xcodeproj -Xcode application scheme is: Application -Xcode test scheme is: ApplicationTests -Excluded paths from coverage are: .*Tests.*,.*3rdParty.* -Extracting Xcode project information -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application clean - -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application -reporter json-compilation-database:compile_commands.json build -Running tests using xctool -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme ApplicationTests -reporter junit GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES test > sonar-reports/TEST-report.xml -Computing coverage report -Path for .gcno/.gcda coverage files is: /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application.build/Debug-iphonesimulator/Application.build/Objects-normal/i386 -Command line exclusion flags for gcovr is: --exclude .*Tests.* --exclude .*3rdParty.* - -+ gcovr -r . /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application.build/Debug-iphonesimulator/Application.build/Objects-normal/i386 --exclude .*Tests.* --exclude .*3rdParty.* --xml > sonar-reports/coverage-Application.xml -Skipping OCLint (test purposes only!) -Running SonarQube using SonarQube Runner -+ sonar-runner ->>>= 0 - -# x. No test scheme provided -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -v -n -<<< -sonar.sources=src -sonar.objectivec.project=Application.xcodeproj -sonar.objectivec.appScheme=Application -sonar.objectivec.excludedPathsFromCoverage=.*Tests.*,.*3rdParty.* ->>> -Running run-sonar.sh... -Xcode workspace file is: -Xcode project file is: Application.xcodeproj -Xcode application scheme is: Application -Xcode test scheme is: -Excluded paths from coverage are: .*Tests.*,.*3rdParty.* -Extracting Xcode project information -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application clean - -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application -reporter json-compilation-database:compile_commands.json build -Skipping tests as no test scheme has been provided! -Running OCLint... -Path included in oclint analysis is: --include .*/shell/src.* -+ oclint-json-compilation-database --include .*/shell/src.* -- -report-type pmd -o sonar-reports/oclint.xml -Running SonarQube using SonarQube Runner -+ sonar-runner ->>>= 0 - -# x. No excluded path from coverage provided -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -v -n -<<< -sonar.sources=src -sonar.objectivec.project=Application.xcodeproj -sonar.objectivec.appScheme=Application -sonar.objectivec.testScheme=ApplicationTests ->>> -Running run-sonar.sh... -Xcode workspace file is: -Xcode project file is: Application.xcodeproj -Xcode application scheme is: Application -Xcode test scheme is: ApplicationTests -Excluded paths from coverage are: -Extracting Xcode project information -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application clean - -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application -reporter json-compilation-database:compile_commands.json build -Running tests using xctool -+ xctool -project Application.xcodeproj -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme ApplicationTests -reporter junit GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES test > sonar-reports/TEST-report.xml -Computing coverage report -Path for .gcno/.gcda coverage files is: /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application.build/Debug-iphonesimulator/Application.build/Objects-normal/i386 -Command line exclusion flags for gcovr is: - -+ gcovr -r . /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application.build/Debug-iphonesimulator/Application.build/Objects-normal/i386 --xml > sonar-reports/coverage-Application.xml -Running OCLint... -Path included in oclint analysis is: --include .*/shell/src.* -+ oclint-json-compilation-database --include .*/shell/src.* -- -report-type pmd -o sonar-reports/oclint.xml -Running SonarQube using SonarQube Runner -+ sonar-runner ->>>= 0 - - -# 5. Setup specific compile_commands.json -tee compile_commands.json | cat > /dev/null -<<< -[ - { - "command" : "blablabla -o \/Users\/user\/Library\/Developer\/Xcode\/DerivedData\/myApplication-hevorauelspmmeblhdabohacuurg\/Build\/Intermediates\/MyDependency.build\/Debug-iphonesimulator\/MyDependency.build\/Objects-normal\/i386\/myFile.o", - "directory" : "titi", - "file" : "myFile.m" - } - { - "command" : "blablabla -o \/Users\/user\/Library\/Developer\/Xcode\/DerivedData\/myApplication-hevorauelspmmeblhdabohacuurg\/Build\/Intermediates\/Application.build\/Debug-iphonesimulator\/Application.build\/Objects-normal\/i386\/myFile.o", - "directory" : "titi", - "file" : "myFile.m" - } -] ->>>= 0 - -# 6. Testing filtering of external projects in workspace -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -v -n -<<< -sonar.sources=src -sonar.objectivec.workspace=Application.xcworkspace -sonar.objectivec.project=Application.xcodeproj -sonar.objectivec.appScheme=Application -sonar.objectivec.testScheme=ApplicationTests -sonar.objectivec.excludedPathsFromCoverage=.*Tests.*,.*3rdParty.* ->>> -Running run-sonar.sh... -Xcode workspace file is: Application.xcworkspace -Xcode project file is: Application.xcodeproj -Xcode application scheme is: Application -Xcode test scheme is: ApplicationTests -Excluded paths from coverage are: .*Tests.*,.*3rdParty.* -Extracting Xcode project information -+ xctool -workspace Application.xcworkspace -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application clean - -+ xctool -workspace Application.xcworkspace -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application -reporter json-compilation-database:compile_commands.json build -Running tests using xctool -+ xctool -workspace Application.xcworkspace -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme ApplicationTests -reporter junit GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES test > sonar-reports/TEST-report.xml -Computing coverage report -Path for .gcno/.gcda coverage files is: /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application.build/Debug-iphonesimulator/Application.build/Objects-normal/i386 -Command line exclusion flags for gcovr is: --exclude .*Tests.* --exclude .*3rdParty.* - -+ gcovr -r . /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application.build/Debug-iphonesimulator/Application.build/Objects-normal/i386 --exclude .*Tests.* --exclude .*3rdParty.* --xml > sonar-reports/coverage-Application.xml -Running OCLint... -Path included in oclint analysis is: --include .*/shell/src.* -+ oclint-json-compilation-database --include .*/shell/src.* -- -report-type pmd -o sonar-reports/oclint.xml -Running SonarQube using SonarQube Runner -+ sonar-runner ->>>= 0 - -# 7. Setup specific compile_commands.json with 2 projects in workspace -tee compile_commands.json | cat > /dev/null -<<< -[ - { - "command" : "blablabla -o \/Users\/user\/Library\/Developer\/Xcode\/DerivedData\/myApplication-hevorauelspmmeblhdabohacuurg\/Build\/Intermediates\/Application1.build\/Debug-iphonesimulator\/Application1.build\/Objects-normal\/i386\/myFile.o", - "directory" : "titi", - "file" : "myFile.m" - } - { - "command" : "blablabla -o \/Users\/user\/Library\/Developer\/Xcode\/DerivedData\/myApplication-hevorauelspmmeblhdabohacuurg\/Build\/Intermediates\/Application2.build\/Debug-iphonesimulator\/Application2.build\/Objects-normal\/i386\/myFile.o", - "directory" : "titi", - "file" : "myFile.m" - } -] ->>>= 0 - -# 8. Testing filtering of external projects in workspace -tee sonar-project.properties | cat > /dev/null; $RUNSONAR_HOME/run-sonar.sh -v -n -<<< -sonar.sources=src -sonar.objectivec.workspace=Application.xcworkspace -sonar.objectivec.project=Application1.xcodeproj,Application2.xcodeproj -sonar.objectivec.appScheme=Application -sonar.objectivec.testScheme=ApplicationTests -sonar.objectivec.excludedPathsFromCoverage=.*Tests.*,.*3rdParty.* ->>> -Running run-sonar.sh... -Xcode workspace file is: Application.xcworkspace -Xcode project file is: Application1.xcodeproj,Application2.xcodeproj -Xcode application scheme is: Application -Xcode test scheme is: ApplicationTests -Excluded paths from coverage are: .*Tests.*,.*3rdParty.* -Extracting Xcode project information -+ xctool -workspace Application.xcworkspace -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application clean - -+ xctool -workspace Application.xcworkspace -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme Application -reporter json-compilation-database:compile_commands.json build -Running tests using xctool -+ xctool -workspace Application.xcworkspace -sdk iphonesimulator ARCHS=i386 VALID_ARCHS=i386 CURRENT_ARCH=i386 ONLY_ACTIVE_ARCH=NO -scheme ApplicationTests -reporter junit GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES test > sonar-reports/TEST-report.xml -Computing coverage report -Path for .gcno/.gcda coverage files is: /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application1.build/Debug-iphonesimulator/Application1.build/Objects-normal/i386 -Command line exclusion flags for gcovr is: --exclude .*Tests.* --exclude .*3rdParty.* - -+ gcovr -r . /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application1.build/Debug-iphonesimulator/Application1.build/Objects-normal/i386 --exclude .*Tests.* --exclude .*3rdParty.* --xml > sonar-reports/coverage-Application1.xml - -Path for .gcno/.gcda coverage files is: /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application2.build/Debug-iphonesimulator/Application2.build/Objects-normal/i386 -Command line exclusion flags for gcovr is: --exclude .*Tests.* --exclude .*3rdParty.* - -+ gcovr -r . /Users/user/Library/Developer/Xcode/DerivedData/myApplication-hevorauelspmmeblhdabohacuurg/Build/Intermediates/Application2.build/Debug-iphonesimulator/Application2.build/Objects-normal/i386 --exclude .*Tests.* --exclude .*3rdParty.* --xml > sonar-reports/coverage-Application2.xml -Running OCLint... -Path included in oclint analysis is: --include .*/shell/src.* -+ oclint-json-compilation-database --include .*/shell/src.* -- -report-type pmd -o sonar-reports/oclint.xml -Running SonarQube using SonarQube Runner -+ sonar-runner ->>>= 0 - - - - diff --git a/src/test/shell/usage.test b/src/test/shell/usage.test deleted file mode 100644 index 5f613c80..00000000 --- a/src/test/shell/usage.test +++ /dev/null @@ -1,34 +0,0 @@ -# 1. Incorrect usage -$RUNSONAR_HOME/run-sonar.sh -titi ->>>2 /Usage: .*run-sonar\.sh \[-v\]/ ->>>= !0 - -# 2. Correct usage -rm -rf sonar-project.properties; $RUNSONAR_HOME/run-sonar.sh ->>> /Running run-sonar.sh\.\.\./ ->>>= !0 - -# 3. Correct usage and verbose -rm -rf sonar-project.properties; $RUNSONAR_HOME/run-sonar.sh -v ->>> /Running run-sonar.sh\.\.\./ ->>>= !0 - -# 4. xctool not installed -# export PATH="/usr/bin:/bin:/usr/sbin:/Users/cpicat/.cabal/bin"; $RUNSONAR_HOME/run-sonar.sh -# >>>2 /ERROR - xctool is not installed or not in your PATH/ -# >>>= !0 - -# 5. gcovr not installed -# mv /Applications/InstalledSoftware/gcovr /Applications/InstalledSoftware/gcovr2; $RUNSONAR_HOME//run-sonar.sh; mv /Applications/InstalledSoftware/gcovr2 /Applications/InstalledSoftware/gcovr -# >>>2 /ERROR - gcovr is not installed or not in your PATH/ -# >>>= 0 - -# 6. oclint not installed -# mv /Applications/InstalledSoftware/oclint-0.8.dev.2888e0f/bin/oclint /Applications/InstalledSoftware/oclint-0.8.dev.2888e0f/bin/oclint2; $RUNSONAR_HOME/run-sonar.sh; mv /Applications/InstalledSoftware/oclint-0.8.dev.2888e0f/bin/oclint2 /Applications/InstalledSoftware/oclint-0.8.dev.2888e0f/bin/oclint -# >>>2 /ERROR - oclint is not installed or not in your PATH/ -# >>>= !0 - -# 7. No sonar-project.properties in current directory -$RUNSONAR_HOME/run-sonar.sh ->>>2 /ERROR - No sonar-project.properties in current directory/ ->>>= !0 From 9e7cbce5331ac22cc6faae9f48f54ca0828769a3 Mon Sep 17 00:00:00 2001 From: Matthew DeTullio Date: Tue, 3 Nov 2015 20:04:55 -0500 Subject: [PATCH 32/42] Change language key to avoid conflict with SonarSource's plugin --- README.md | 2 +- pom.xml | 4 ++-- src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java | 4 ++-- .../resources/org/sonar/plugins/objectivec/profile-clang.xml | 4 ++-- .../resources/org/sonar/plugins/objectivec/profile-oclint.xml | 4 ++-- updateRules.groovy | 2 +- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 250e3723..7a335458 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# SonarQube Plugin for Objective-C +# SonarQube Objective-C (Community) Plugin This repository hosts the Objective-C plugin for [SonarQube](http://www.sonarqube.org/). This plugin aims to analyze and track diff --git a/pom.xml b/pom.xml index 1bf6f2a9..41949ea3 100644 --- a/pom.xml +++ b/pom.xml @@ -13,7 +13,7 @@ 0.5.0-SNAPSHOT sonar-plugin - SonarQube Objective-C Plugin + SonarQube Objective-C (Community) Plugin Enable analysis and reporting on Objective-C projects. https://github.com/octo-technology/sonar-objective-c @@ -97,7 +97,7 @@ org.sonar.plugins.objectivec.ObjectiveCPlugin - Objective-C + Objective-C (Community) diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java b/src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java index bac72a09..c4e1d286 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java +++ b/src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java @@ -32,12 +32,12 @@ public class ObjectiveC extends AbstractLanguage { /** * Objective-C key */ - public static final String KEY = "objc"; + public static final String KEY = "objectivec"; /** * Objective-C name */ - public static final String NAME = "Objective-C"; + public static final String NAME = "Objective-C (Community)"; /** * Key of the file suffix parameter diff --git a/src/main/resources/org/sonar/plugins/objectivec/profile-clang.xml b/src/main/resources/org/sonar/plugins/objectivec/profile-clang.xml index dc003b7a..1214c803 100644 --- a/src/main/resources/org/sonar/plugins/objectivec/profile-clang.xml +++ b/src/main/resources/org/sonar/plugins/objectivec/profile-clang.xml @@ -1,6 +1,6 @@ Clang - objc + objectivec clang @@ -43,4 +43,4 @@ other - \ No newline at end of file + diff --git a/src/main/resources/org/sonar/plugins/objectivec/profile-oclint.xml b/src/main/resources/org/sonar/plugins/objectivec/profile-oclint.xml index 7e97b037..078e7679 100644 --- a/src/main/resources/org/sonar/plugins/objectivec/profile-oclint.xml +++ b/src/main/resources/org/sonar/plugins/objectivec/profile-oclint.xml @@ -1,6 +1,6 @@ OCLint - objc + objectivec OCLint @@ -255,4 +255,4 @@ use early exits and continue - \ No newline at end of file + diff --git a/updateRules.groovy b/updateRules.groovy index 5697f8f6..7edc532e 100644 --- a/updateRules.groovy +++ b/updateRules.groovy @@ -102,7 +102,7 @@ def writeProfileOCLint() { MarkupBuilder xml = new MarkupBuilder(new IndentPrinter(writer, " ")) xml.profile() { name "OCLint" - language "objc" + language "objectivec" rules { rulesXml.rule.each { rl -> rule { From 05313a979609cf324d8c9b5775e947997a6866f3 Mon Sep 17 00:00:00 2001 From: Matthew DeTullio Date: Wed, 4 Nov 2015 12:53:36 -0500 Subject: [PATCH 33/42] OCLint SQALE model: Issues should be CONSTANT_ISSUE with offset --- .../com/sonar/sqale/oclint-model.xml | 630 +++++++++--------- 1 file changed, 315 insertions(+), 315 deletions(-) diff --git a/src/main/resources/com/sonar/sqale/oclint-model.xml b/src/main/resources/com/sonar/sqale/oclint-model.xml index 42c209fb..b64f6550 100644 --- a/src/main/resources/com/sonar/sqale/oclint-model.xml +++ b/src/main/resources/com/sonar/sqale/oclint-model.xml @@ -50,17 +50,17 @@ unused method parameter remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn
@@ -68,17 +68,17 @@ unused local variable remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -86,17 +86,17 @@ replace with number literal remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -104,17 +104,17 @@ replace with boxed expression remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -122,17 +122,17 @@ unnecessary else statement remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -140,17 +140,17 @@ redundant local variable remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -158,17 +158,17 @@ redundant if statement remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -176,17 +176,17 @@ redundant conditional operator remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -194,17 +194,17 @@ replace with container literal remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -212,17 +212,17 @@ long line remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -230,17 +230,17 @@ long method remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 30 - mn + 0.0 + d offset - 0.0 - d + 30 + mn @@ -248,17 +248,17 @@ for loop should be while loop remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -266,17 +266,17 @@ too many methods remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 1 - h + 0.0 + d offset - 0.0 - d + 1 + h @@ -284,17 +284,17 @@ long class remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 1 - h + 0.0 + d offset - 0.0 - d + 1 + h @@ -302,17 +302,17 @@ too many fields remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 1 - h + 0.0 + d offset - 0.0 - d + 1 + h @@ -320,17 +320,17 @@ collapsible if statements remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 30 - mn + 0.0 + d offset - 0.0 - d + 30 + mn @@ -338,17 +338,17 @@ deep nested block remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 30 - mn + 0.0 + d offset - 0.0 - d + 30 + mn @@ -356,17 +356,17 @@ high cyclomatic complexity remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 30 - mn + 0.0 + d offset - 0.0 - d + 30 + mn @@ -374,17 +374,17 @@ too few branches in switch statement remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -392,17 +392,17 @@ non case label in switch statement remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -410,17 +410,17 @@ short variable name remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -428,17 +428,17 @@ long variable name remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -446,17 +446,17 @@ default label not last in switch statement remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -464,17 +464,17 @@ replace with object subscripting remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn
@@ -486,17 +486,17 @@ useless parentheses remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn
@@ -504,17 +504,17 @@ use early exits and continue remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -522,17 +522,17 @@ high npath complexity remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 30 - mn + 0.0 + d offset - 0.0 - d + 30 + mn @@ -540,17 +540,17 @@ inverted logic remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -558,17 +558,17 @@ multiple unary operator remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -576,17 +576,17 @@ redundant nil check remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -594,17 +594,17 @@ high ncss method remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -612,17 +612,17 @@ dead code remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -630,17 +630,17 @@ double negative remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -648,17 +648,17 @@ bitwise operator in conditional remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -666,17 +666,17 @@ empty if statement remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -684,17 +684,17 @@ empty while statement remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -702,17 +702,17 @@ empty else block remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -720,17 +720,17 @@ empty for statement remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -738,17 +738,17 @@ empty do/while statement remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -756,17 +756,17 @@ empty switch statement remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -774,17 +774,17 @@ too many parameters remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 30 - mn + 0.0 + d offset - 0.0 - d + 30 + mn @@ -792,17 +792,17 @@ switch statements don't need default when fully covered remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -874,17 +874,17 @@ empty finally statement remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -892,17 +892,17 @@ return from finally block remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -910,17 +910,17 @@ empty catch statement remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -928,17 +928,17 @@ empty try statement remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -946,17 +946,17 @@ throw exception from finally block remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -972,17 +972,17 @@ must override hash with isEqual remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -990,17 +990,17 @@ parameter reassignment remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 30 - mn + 0.0 + d offset - 0.0 - d + 30 + mn @@ -1008,17 +1008,17 @@ ivar assignment outside accessors or init remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -1030,17 +1030,17 @@ missing break in switch statement remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -1048,17 +1048,17 @@ avoid branching statement as last in loop remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 30 - mn + 0.0 + d offset - 0.0 - d + 30 + mn @@ -1066,17 +1066,17 @@ switch statements should have default remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -1084,17 +1084,17 @@ jumbled incrementer remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -1102,17 +1102,17 @@ broken null check remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -1120,17 +1120,17 @@ broken nil check remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -1138,17 +1138,17 @@ broken oddness check remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -1156,17 +1156,17 @@ misplaced nil check remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -1174,17 +1174,17 @@ misplaced null check remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -1192,17 +1192,17 @@ goto statement remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 30 - mn + 0.0 + d offset - 0.0 - d + 30 + mn @@ -1210,17 +1210,17 @@ goto statement remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 30 - mn + 0.0 + d offset - 0.0 - d + 30 + mn @@ -1228,17 +1228,17 @@ constant if expression remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn @@ -1246,17 +1246,17 @@ constant conditional operator remediationFunction - linear + CONSTANT_ISSUE remediationFactor - 10 - mn + 0.0 + d offset - 0.0 - d + 10 + mn From 307cb4719a795845a36c0b9a6d9b3713f0144351 Mon Sep 17 00:00:00 2001 From: Matthew DeTullio Date: Mon, 22 Feb 2016 14:19:52 -0500 Subject: [PATCH 34/42] Add Bitrise sample project --- .../.gitignore | 12 + .../project.pbxproj | 529 ++++++++++++++++++ .../contents.xcworkspacedata | 7 + ...triseSampleUnitAndOtherTestsApp.xccheckout | 41 ++ ...BitriseSampleUnitAndOtherTestsApp.xcscheme | 110 ++++ .../AppDelegate.h | 25 + .../AppDelegate.m | 127 +++++ .../Base.lproj/LaunchScreen.xib | 41 ++ .../Base.lproj/Main.storyboard | 25 + .../.xccurrentversion | 8 + .../contents | 4 + .../AppIcon.appiconset/Contents.json | 68 +++ .../Info.plist | 47 ++ .../ViewController.h | 15 + .../ViewController.m | 27 + .../BitriseSampleUnitAndOtherTestsApp/main.m | 16 + .../BitriseSampleUnitAndOtherTestsAppTests.m | 40 ++ .../Info.plist | 24 + .../KiwiSampleSpec.m | 21 + .../Podfile.lock | 10 + .../fastlane/Fastfile | 45 ++ .../fastlane/README.md | 32 ++ .../BitriseSampleUnitAndOtherTestsApp/podfile | 16 + 23 files changed, 1290 insertions(+) create mode 100644 projects/BitriseSampleUnitAndOtherTestsApp/.gitignore create mode 100644 projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/project.pbxproj create mode 100644 projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata create mode 100644 projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/project.xcworkspace/xcshareddata/BitriseSampleUnitAndOtherTestsApp.xccheckout create mode 100644 projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/xcshareddata/xcschemes/BitriseSampleUnitAndOtherTestsApp.xcscheme create mode 100644 projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/AppDelegate.h create mode 100644 projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/AppDelegate.m create mode 100644 projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Base.lproj/LaunchScreen.xib create mode 100644 projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Base.lproj/Main.storyboard create mode 100644 projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcdatamodeld/.xccurrentversion create mode 100644 projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcdatamodeld/BitriseSampleUnitAndOtherTestsApp.xcdatamodel/contents create mode 100644 projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Images.xcassets/AppIcon.appiconset/Contents.json create mode 100644 projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Info.plist create mode 100644 projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/ViewController.h create mode 100644 projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/ViewController.m create mode 100644 projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/main.m create mode 100644 projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsAppTests/BitriseSampleUnitAndOtherTestsAppTests.m create mode 100644 projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsAppTests/Info.plist create mode 100644 projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsAppTests/KiwiSampleSpec.m create mode 100644 projects/BitriseSampleUnitAndOtherTestsApp/Podfile.lock create mode 100644 projects/BitriseSampleUnitAndOtherTestsApp/fastlane/Fastfile create mode 100644 projects/BitriseSampleUnitAndOtherTestsApp/fastlane/README.md create mode 100644 projects/BitriseSampleUnitAndOtherTestsApp/podfile diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/.gitignore b/projects/BitriseSampleUnitAndOtherTestsApp/.gitignore new file mode 100644 index 00000000..703a6680 --- /dev/null +++ b/projects/BitriseSampleUnitAndOtherTestsApp/.gitignore @@ -0,0 +1,12 @@ +# Generated by CocoaPods +BitriseSampleUnitAndOtherTestsApp.xcworkspace +# Do not commit pods +Pods +# Intermediates +DerivedData +*.build +build +compile_commands.json +# Fastlane reports +fastlane/report.xml +fastlane/test_output/ diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/project.pbxproj b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/project.pbxproj new file mode 100644 index 00000000..846e60f9 --- /dev/null +++ b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/project.pbxproj @@ -0,0 +1,529 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 034A115CFB09157FF7774084 /* libPods-BitriseSampleUnitAndOtherTestsAppTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 4A1C2291B3F12AB7FE98610D /* libPods-BitriseSampleUnitAndOtherTestsAppTests.a */; }; + BA0609DC1AA610E100F24A40 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = BA0609DB1AA610E100F24A40 /* main.m */; }; + BA0609DF1AA610E100F24A40 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = BA0609DE1AA610E100F24A40 /* AppDelegate.m */; }; + BA0609E21AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsApp.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = BA0609E01AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsApp.xcdatamodeld */; }; + BA0609E51AA610E100F24A40 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = BA0609E41AA610E100F24A40 /* ViewController.m */; }; + BA0609E81AA610E100F24A40 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = BA0609E61AA610E100F24A40 /* Main.storyboard */; }; + BA0609EA1AA610E100F24A40 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BA0609E91AA610E100F24A40 /* Images.xcassets */; }; + BA0609ED1AA610E100F24A40 /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = BA0609EB1AA610E100F24A40 /* LaunchScreen.xib */; }; + BA0609F91AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsAppTests.m in Sources */ = {isa = PBXBuildFile; fileRef = BA0609F81AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsAppTests.m */; }; + BA7CF5CA1AA61A7A00DEB100 /* KiwiSampleSpec.m in Sources */ = {isa = PBXBuildFile; fileRef = BA7CF5C91AA61A7A00DEB100 /* KiwiSampleSpec.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + BA0609F31AA610E100F24A40 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = BA0609CE1AA610E100F24A40 /* Project object */; + proxyType = 1; + remoteGlobalIDString = BA0609D51AA610E100F24A40; + remoteInfo = BitriseSampleUnitAndOtherTestsApp; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 4A1C2291B3F12AB7FE98610D /* libPods-BitriseSampleUnitAndOtherTestsAppTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-BitriseSampleUnitAndOtherTestsAppTests.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + 61199DC195E180BBB3AA23C7 /* Pods-BitriseSampleUnitAndOtherTestsAppTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BitriseSampleUnitAndOtherTestsAppTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-BitriseSampleUnitAndOtherTestsAppTests/Pods-BitriseSampleUnitAndOtherTestsAppTests.release.xcconfig"; sourceTree = ""; }; + 7E1D6E3986AFC399154EA64A /* Pods-BitriseSampleUnitAndOtherTestsAppTests.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BitriseSampleUnitAndOtherTestsAppTests.debug.xcconfig"; path = "Pods/Target Support Files/Pods-BitriseSampleUnitAndOtherTestsAppTests/Pods-BitriseSampleUnitAndOtherTestsAppTests.debug.xcconfig"; sourceTree = ""; }; + BA0609D61AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsApp.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = BitriseSampleUnitAndOtherTestsApp.app; sourceTree = BUILT_PRODUCTS_DIR; }; + BA0609DA1AA610E100F24A40 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + BA0609DB1AA610E100F24A40 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + BA0609DD1AA610E100F24A40 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + BA0609DE1AA610E100F24A40 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + BA0609E11AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsApp.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = BitriseSampleUnitAndOtherTestsApp.xcdatamodel; sourceTree = ""; }; + BA0609E31AA610E100F24A40 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; + BA0609E41AA610E100F24A40 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; + BA0609E71AA610E100F24A40 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; + BA0609E91AA610E100F24A40 /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Images.xcassets; sourceTree = ""; }; + BA0609EC1AA610E100F24A40 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/LaunchScreen.xib; sourceTree = ""; }; + BA0609F21AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsAppTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = BitriseSampleUnitAndOtherTestsAppTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; }; + BA0609F71AA610E100F24A40 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + BA0609F81AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsAppTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BitriseSampleUnitAndOtherTestsAppTests.m; sourceTree = ""; }; + BA7CF5C91AA61A7A00DEB100 /* KiwiSampleSpec.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = KiwiSampleSpec.m; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + BA0609D31AA610E100F24A40 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + BA0609EF1AA610E100F24A40 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 034A115CFB09157FF7774084 /* libPods-BitriseSampleUnitAndOtherTestsAppTests.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 41062A375877A3BBAFC6FC09 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 4A1C2291B3F12AB7FE98610D /* libPods-BitriseSampleUnitAndOtherTestsAppTests.a */, + ); + name = Frameworks; + sourceTree = ""; + }; + 585C9977CABCF795A39E691A /* Pods */ = { + isa = PBXGroup; + children = ( + 7E1D6E3986AFC399154EA64A /* Pods-BitriseSampleUnitAndOtherTestsAppTests.debug.xcconfig */, + 61199DC195E180BBB3AA23C7 /* Pods-BitriseSampleUnitAndOtherTestsAppTests.release.xcconfig */, + ); + name = Pods; + sourceTree = ""; + }; + BA0609CD1AA610E000F24A40 = { + isa = PBXGroup; + children = ( + BA0609D81AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsApp */, + BA0609F51AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsAppTests */, + BA0609D71AA610E100F24A40 /* Products */, + 585C9977CABCF795A39E691A /* Pods */, + 41062A375877A3BBAFC6FC09 /* Frameworks */, + ); + sourceTree = ""; + }; + BA0609D71AA610E100F24A40 /* Products */ = { + isa = PBXGroup; + children = ( + BA0609D61AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsApp.app */, + BA0609F21AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsAppTests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + BA0609D81AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsApp */ = { + isa = PBXGroup; + children = ( + BA0609DD1AA610E100F24A40 /* AppDelegate.h */, + BA0609DE1AA610E100F24A40 /* AppDelegate.m */, + BA0609E31AA610E100F24A40 /* ViewController.h */, + BA0609E41AA610E100F24A40 /* ViewController.m */, + BA0609E61AA610E100F24A40 /* Main.storyboard */, + BA0609E91AA610E100F24A40 /* Images.xcassets */, + BA0609EB1AA610E100F24A40 /* LaunchScreen.xib */, + BA0609E01AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsApp.xcdatamodeld */, + BA0609D91AA610E100F24A40 /* Supporting Files */, + ); + path = BitriseSampleUnitAndOtherTestsApp; + sourceTree = ""; + }; + BA0609D91AA610E100F24A40 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + BA0609DA1AA610E100F24A40 /* Info.plist */, + BA0609DB1AA610E100F24A40 /* main.m */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; + BA0609F51AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsAppTests */ = { + isa = PBXGroup; + children = ( + BA7CF5C91AA61A7A00DEB100 /* KiwiSampleSpec.m */, + BA0609F81AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsAppTests.m */, + BA0609F61AA610E100F24A40 /* Supporting Files */, + ); + path = BitriseSampleUnitAndOtherTestsAppTests; + sourceTree = ""; + }; + BA0609F61AA610E100F24A40 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + BA0609F71AA610E100F24A40 /* Info.plist */, + ); + name = "Supporting Files"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + BA0609D51AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsApp */ = { + isa = PBXNativeTarget; + buildConfigurationList = BA0609FC1AA610E100F24A40 /* Build configuration list for PBXNativeTarget "BitriseSampleUnitAndOtherTestsApp" */; + buildPhases = ( + BA0609D21AA610E100F24A40 /* Sources */, + BA0609D31AA610E100F24A40 /* Frameworks */, + BA0609D41AA610E100F24A40 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = BitriseSampleUnitAndOtherTestsApp; + productName = BitriseSampleUnitAndOtherTestsApp; + productReference = BA0609D61AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsApp.app */; + productType = "com.apple.product-type.application"; + }; + BA0609F11AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsAppTests */ = { + isa = PBXNativeTarget; + buildConfigurationList = BA0609FF1AA610E100F24A40 /* Build configuration list for PBXNativeTarget "BitriseSampleUnitAndOtherTestsAppTests" */; + buildPhases = ( + 20F1B93E6202C972E5B4404D /* Check Pods Manifest.lock */, + BA0609EE1AA610E100F24A40 /* Sources */, + BA0609EF1AA610E100F24A40 /* Frameworks */, + BA0609F01AA610E100F24A40 /* Resources */, + 2DDCD1A2A0EAD8F03EFB5548 /* Copy Pods Resources */, + B8F3940202BFA0A79732360A /* Embed Pods Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + BA0609F41AA610E100F24A40 /* PBXTargetDependency */, + ); + name = BitriseSampleUnitAndOtherTestsAppTests; + productName = BitriseSampleUnitAndOtherTestsAppTests; + productReference = BA0609F21AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsAppTests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + BA0609CE1AA610E100F24A40 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0610; + ORGANIZATIONNAME = Bitrise; + TargetAttributes = { + BA0609D51AA610E100F24A40 = { + CreatedOnToolsVersion = 6.1.1; + }; + BA0609F11AA610E100F24A40 = { + CreatedOnToolsVersion = 6.1.1; + TestTargetID = BA0609D51AA610E100F24A40; + }; + }; + }; + buildConfigurationList = BA0609D11AA610E100F24A40 /* Build configuration list for PBXProject "BitriseSampleUnitAndOtherTestsApp" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + Base, + ); + mainGroup = BA0609CD1AA610E000F24A40; + productRefGroup = BA0609D71AA610E100F24A40 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + BA0609D51AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsApp */, + BA0609F11AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsAppTests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + BA0609D41AA610E100F24A40 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + BA0609E81AA610E100F24A40 /* Main.storyboard in Resources */, + BA0609ED1AA610E100F24A40 /* LaunchScreen.xib in Resources */, + BA0609EA1AA610E100F24A40 /* Images.xcassets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + BA0609F01AA610E100F24A40 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 20F1B93E6202C972E5B4404D /* Check Pods Manifest.lock */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Check Pods Manifest.lock"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [[ $? != 0 ]] ; then\n cat << EOM\nerror: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\nEOM\n exit 1\nfi\n"; + showEnvVarsInLog = 0; + }; + 2DDCD1A2A0EAD8F03EFB5548 /* Copy Pods Resources */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Copy Pods Resources"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-BitriseSampleUnitAndOtherTestsAppTests/Pods-BitriseSampleUnitAndOtherTestsAppTests-resources.sh\"\n"; + showEnvVarsInLog = 0; + }; + B8F3940202BFA0A79732360A /* Embed Pods Frameworks */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Embed Pods Frameworks"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "\"${SRCROOT}/Pods/Target Support Files/Pods-BitriseSampleUnitAndOtherTestsAppTests/Pods-BitriseSampleUnitAndOtherTestsAppTests-frameworks.sh\"\n"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + BA0609D21AA610E100F24A40 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + BA0609DF1AA610E100F24A40 /* AppDelegate.m in Sources */, + BA0609E21AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsApp.xcdatamodeld in Sources */, + BA0609E51AA610E100F24A40 /* ViewController.m in Sources */, + BA0609DC1AA610E100F24A40 /* main.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + BA0609EE1AA610E100F24A40 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + BA7CF5CA1AA61A7A00DEB100 /* KiwiSampleSpec.m in Sources */, + BA0609F91AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsAppTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + BA0609F41AA610E100F24A40 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = BA0609D51AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsApp */; + targetProxy = BA0609F31AA610E100F24A40 /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + BA0609E61AA610E100F24A40 /* Main.storyboard */ = { + isa = PBXVariantGroup; + children = ( + BA0609E71AA610E100F24A40 /* Base */, + ); + name = Main.storyboard; + sourceTree = ""; + }; + BA0609EB1AA610E100F24A40 /* LaunchScreen.xib */ = { + isa = PBXVariantGroup; + children = ( + BA0609EC1AA610E100F24A40 /* Base */, + ); + name = LaunchScreen.xib; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + BA0609FA1AA610E100F24A40 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.1; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + BA0609FB1AA610E100F24A40 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.1; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + BA0609FD1AA610E100F24A40 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = BitriseSampleUnitAndOtherTestsApp/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + BA0609FE1AA610E100F24A40 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + INFOPLIST_FILE = BitriseSampleUnitAndOtherTestsApp/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + BA060A001AA610E100F24A40 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 7E1D6E3986AFC399154EA64A /* Pods-BitriseSampleUnitAndOtherTestsAppTests.debug.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + INFOPLIST_FILE = BitriseSampleUnitAndOtherTestsAppTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/BitriseSampleUnitAndOtherTestsApp.app/BitriseSampleUnitAndOtherTestsApp"; + }; + name = Debug; + }; + BA060A011AA610E100F24A40 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 61199DC195E180BBB3AA23C7 /* Pods-BitriseSampleUnitAndOtherTestsAppTests.release.xcconfig */; + buildSettings = { + BUNDLE_LOADER = "$(TEST_HOST)"; + FRAMEWORK_SEARCH_PATHS = ( + "$(SDKROOT)/Developer/Library/Frameworks", + "$(inherited)", + ); + INFOPLIST_FILE = BitriseSampleUnitAndOtherTestsAppTests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_NAME = "$(TARGET_NAME)"; + TEST_HOST = "$(BUILT_PRODUCTS_DIR)/BitriseSampleUnitAndOtherTestsApp.app/BitriseSampleUnitAndOtherTestsApp"; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + BA0609D11AA610E100F24A40 /* Build configuration list for PBXProject "BitriseSampleUnitAndOtherTestsApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + BA0609FA1AA610E100F24A40 /* Debug */, + BA0609FB1AA610E100F24A40 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + BA0609FC1AA610E100F24A40 /* Build configuration list for PBXNativeTarget "BitriseSampleUnitAndOtherTestsApp" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + BA0609FD1AA610E100F24A40 /* Debug */, + BA0609FE1AA610E100F24A40 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + BA0609FF1AA610E100F24A40 /* Build configuration list for PBXNativeTarget "BitriseSampleUnitAndOtherTestsAppTests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + BA060A001AA610E100F24A40 /* Debug */, + BA060A011AA610E100F24A40 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + +/* Begin XCVersionGroup section */ + BA0609E01AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsApp.xcdatamodeld */ = { + isa = XCVersionGroup; + children = ( + BA0609E11AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsApp.xcdatamodel */, + ); + currentVersion = BA0609E11AA610E100F24A40 /* BitriseSampleUnitAndOtherTestsApp.xcdatamodel */; + path = BitriseSampleUnitAndOtherTestsApp.xcdatamodeld; + sourceTree = ""; + versionGroupType = wrapper.xcdatamodel; + }; +/* End XCVersionGroup section */ + }; + rootObject = BA0609CE1AA610E100F24A40 /* Project object */; +} diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..86d371e8 --- /dev/null +++ b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/project.xcworkspace/xcshareddata/BitriseSampleUnitAndOtherTestsApp.xccheckout b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/project.xcworkspace/xcshareddata/BitriseSampleUnitAndOtherTestsApp.xccheckout new file mode 100644 index 00000000..fa1f40e5 --- /dev/null +++ b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/project.xcworkspace/xcshareddata/BitriseSampleUnitAndOtherTestsApp.xccheckout @@ -0,0 +1,41 @@ + + + + + IDESourceControlProjectFavoriteDictionaryKey + + IDESourceControlProjectIdentifier + 07529588-2568-4464-9D55-E3A30DB2D63A + IDESourceControlProjectName + BitriseSampleUnitAndOtherTestsApp + IDESourceControlProjectOriginsDictionary + + D8379880FB320D8E1DBD87F3490D48DFF1337CDB + github.com:bitrise-io/sample-apps-ios-unit-and-other-tests.git + + IDESourceControlProjectPath + BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj + IDESourceControlProjectRelativeInstallPathDictionary + + D8379880FB320D8E1DBD87F3490D48DFF1337CDB + ../../.. + + IDESourceControlProjectURL + github.com:bitrise-io/sample-apps-ios-unit-and-other-tests.git + IDESourceControlProjectVersion + 111 + IDESourceControlProjectWCCIdentifier + D8379880FB320D8E1DBD87F3490D48DFF1337CDB + IDESourceControlProjectWCConfigurations + + + IDESourceControlRepositoryExtensionIdentifierKey + public.vcs.git + IDESourceControlWCCIdentifierKey + D8379880FB320D8E1DBD87F3490D48DFF1337CDB + IDESourceControlWCCName + sample-apps-ios-unit-and-other-tests + + + + diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/xcshareddata/xcschemes/BitriseSampleUnitAndOtherTestsApp.xcscheme b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/xcshareddata/xcschemes/BitriseSampleUnitAndOtherTestsApp.xcscheme new file mode 100644 index 00000000..7f21e26e --- /dev/null +++ b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/xcshareddata/xcschemes/BitriseSampleUnitAndOtherTestsApp.xcscheme @@ -0,0 +1,110 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/AppDelegate.h b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/AppDelegate.h new file mode 100644 index 00000000..a65752d1 --- /dev/null +++ b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/AppDelegate.h @@ -0,0 +1,25 @@ +// +// AppDelegate.h +// BitriseSampleUnitAndOtherTestsApp +// +// Created by Viktor Benei on 3/3/15. +// Copyright (c) 2015 Bitrise. All rights reserved. +// + +#import +#import + +@interface AppDelegate : UIResponder + +@property (strong, nonatomic) UIWindow *window; + +@property (readonly, strong, nonatomic) NSManagedObjectContext *managedObjectContext; +@property (readonly, strong, nonatomic) NSManagedObjectModel *managedObjectModel; +@property (readonly, strong, nonatomic) NSPersistentStoreCoordinator *persistentStoreCoordinator; + +- (void)saveContext; +- (NSURL *)applicationDocumentsDirectory; + + +@end + diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/AppDelegate.m b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/AppDelegate.m new file mode 100644 index 00000000..dd5b82c6 --- /dev/null +++ b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/AppDelegate.m @@ -0,0 +1,127 @@ +// +// AppDelegate.m +// BitriseSampleUnitAndOtherTestsApp +// +// Created by Viktor Benei on 3/3/15. +// Copyright (c) 2015 Bitrise. All rights reserved. +// + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + return YES; +} + +- (void)applicationWillResignActive:(UIApplication *)application { + // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. + // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. +} + +- (void)applicationDidEnterBackground:(UIApplication *)application { + // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. + // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. +} + +- (void)applicationWillEnterForeground:(UIApplication *)application { + // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. +} + +- (void)applicationDidBecomeActive:(UIApplication *)application { + // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. +} + +- (void)applicationWillTerminate:(UIApplication *)application { + // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. + // Saves changes in the application's managed object context before the application terminates. + [self saveContext]; +} + +#pragma mark - Core Data stack + +@synthesize managedObjectContext = _managedObjectContext; +@synthesize managedObjectModel = _managedObjectModel; +@synthesize persistentStoreCoordinator = _persistentStoreCoordinator; + +- (NSURL *)applicationDocumentsDirectory { + // The directory the application uses to store the Core Data store file. This code uses a directory named "com.bitrise.BitriseSampleUnitAndOtherTestsApp" in the application's documents directory. + return [[[NSFileManager defaultManager] URLsForDirectory:NSDocumentDirectory inDomains:NSUserDomainMask] lastObject]; +} + +- (NSManagedObjectModel *)managedObjectModel { + // The managed object model for the application. It is a fatal error for the application not to be able to find and load its model. + if (_managedObjectModel != nil) { + return _managedObjectModel; + } + NSURL *modelURL = [[NSBundle mainBundle] URLForResource:@"BitriseSampleUnitAndOtherTestsApp" withExtension:@"momd"]; + _managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:modelURL]; + return _managedObjectModel; +} + +- (NSPersistentStoreCoordinator *)persistentStoreCoordinator { + // The persistent store coordinator for the application. This implementation creates and return a coordinator, having added the store for the application to it. + if (_persistentStoreCoordinator != nil) { + return _persistentStoreCoordinator; + } + + // Create the coordinator and store + + _persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] initWithManagedObjectModel:[self managedObjectModel]]; + NSURL *storeURL = [[self applicationDocumentsDirectory] URLByAppendingPathComponent:@"BitriseSampleUnitAndOtherTestsApp.sqlite"]; + NSError *error = nil; + NSString *failureReason = @"There was an error creating or loading the application's saved data."; + if (![_persistentStoreCoordinator addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeURL options:nil error:&error]) { + // Report any error we got. + NSMutableDictionary *dict = [NSMutableDictionary dictionary]; + dict[NSLocalizedDescriptionKey] = @"Failed to initialize the application's saved data"; + dict[NSLocalizedFailureReasonErrorKey] = failureReason; + dict[NSUnderlyingErrorKey] = error; + error = [NSError errorWithDomain:@"YOUR_ERROR_DOMAIN" code:9999 userInfo:dict]; + // Replace this with code to handle the error appropriately. + // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. + NSLog(@"Unresolved error %@, %@", error, [error userInfo]); + abort(); + } + + return _persistentStoreCoordinator; +} + + +- (NSManagedObjectContext *)managedObjectContext { + // Returns the managed object context for the application (which is already bound to the persistent store coordinator for the application.) + if (_managedObjectContext != nil) { + return _managedObjectContext; + } + + NSPersistentStoreCoordinator *coordinator = [self persistentStoreCoordinator]; + if (!coordinator) { + return nil; + } + _managedObjectContext = [[NSManagedObjectContext alloc] init]; + [_managedObjectContext setPersistentStoreCoordinator:coordinator]; + return _managedObjectContext; +} + +#pragma mark - Core Data Saving support + +- (void)saveContext { + NSManagedObjectContext *managedObjectContext = self.managedObjectContext; + if (managedObjectContext != nil) { + NSError *error = nil; + if ([managedObjectContext hasChanges] && ![managedObjectContext save:&error]) { + // Replace this implementation with code to handle the error appropriately. + // abort() causes the application to generate a crash log and terminate. You should not use this function in a shipping application, although it may be useful during development. + NSLog(@"Unresolved error %@, %@", error, [error userInfo]); + abort(); + } + } +} + +@end diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Base.lproj/LaunchScreen.xib b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Base.lproj/LaunchScreen.xib new file mode 100644 index 00000000..3c0ad3fe --- /dev/null +++ b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Base.lproj/LaunchScreen.xib @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Base.lproj/Main.storyboard b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Base.lproj/Main.storyboard new file mode 100644 index 00000000..f56d2f3b --- /dev/null +++ b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Base.lproj/Main.storyboard @@ -0,0 +1,25 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcdatamodeld/.xccurrentversion b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcdatamodeld/.xccurrentversion new file mode 100644 index 00000000..7a2b9665 --- /dev/null +++ b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcdatamodeld/.xccurrentversion @@ -0,0 +1,8 @@ + + + + + _XCCurrentVersionName + BitriseSampleUnitAndOtherTestsApp.xcdatamodel + + diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcdatamodeld/BitriseSampleUnitAndOtherTestsApp.xcdatamodel/contents b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcdatamodeld/BitriseSampleUnitAndOtherTestsApp.xcdatamodel/contents new file mode 100644 index 00000000..193f33c9 --- /dev/null +++ b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcdatamodeld/BitriseSampleUnitAndOtherTestsApp.xcdatamodel/contents @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Images.xcassets/AppIcon.appiconset/Contents.json b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Images.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 00000000..36d2c80d --- /dev/null +++ b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Images.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,68 @@ +{ + "images" : [ + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "29x29", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "40x40", + "scale" : "3x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "2x" + }, + { + "idiom" : "iphone", + "size" : "60x60", + "scale" : "3x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "29x29", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "40x40", + "scale" : "2x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "1x" + }, + { + "idiom" : "ipad", + "size" : "76x76", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} \ No newline at end of file diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Info.plist b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Info.plist new file mode 100644 index 00000000..e47f46e1 --- /dev/null +++ b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Info.plist @@ -0,0 +1,47 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + com.bitrise.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + LSRequiresIPhoneOS + + UILaunchStoryboardName + LaunchScreen + UIMainStoryboardFile + Main + UIRequiredDeviceCapabilities + + armv7 + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationLandscapeRight + + + diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/ViewController.h b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/ViewController.h new file mode 100644 index 00000000..8d84cc56 --- /dev/null +++ b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/ViewController.h @@ -0,0 +1,15 @@ +// +// ViewController.h +// BitriseSampleUnitAndOtherTestsApp +// +// Created by Viktor Benei on 3/3/15. +// Copyright (c) 2015 Bitrise. All rights reserved. +// + +#import + +@interface ViewController : UIViewController + + +@end + diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/ViewController.m b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/ViewController.m new file mode 100644 index 00000000..cf68b7e8 --- /dev/null +++ b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/ViewController.m @@ -0,0 +1,27 @@ +// +// ViewController.m +// BitriseSampleUnitAndOtherTestsApp +// +// Created by Viktor Benei on 3/3/15. +// Copyright (c) 2015 Bitrise. All rights reserved. +// + +#import "ViewController.h" + +@interface ViewController () + +@end + +@implementation ViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + // Do any additional setup after loading the view, typically from a nib. +} + +- (void)didReceiveMemoryWarning { + [super didReceiveMemoryWarning]; + // Dispose of any resources that can be recreated. +} + +@end diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/main.m b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/main.m new file mode 100644 index 00000000..262bbc00 --- /dev/null +++ b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/main.m @@ -0,0 +1,16 @@ +// +// main.m +// BitriseSampleUnitAndOtherTestsApp +// +// Created by Viktor Benei on 3/3/15. +// Copyright (c) 2015 Bitrise. All rights reserved. +// + +#import +#import "AppDelegate.h" + +int main(int argc, char * argv[]) { + @autoreleasepool { + return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsAppTests/BitriseSampleUnitAndOtherTestsAppTests.m b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsAppTests/BitriseSampleUnitAndOtherTestsAppTests.m new file mode 100644 index 00000000..d3bd580f --- /dev/null +++ b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsAppTests/BitriseSampleUnitAndOtherTestsAppTests.m @@ -0,0 +1,40 @@ +// +// BitriseSampleUnitAndOtherTestsAppTests.m +// BitriseSampleUnitAndOtherTestsAppTests +// +// Created by Viktor Benei on 3/3/15. +// Copyright (c) 2015 Bitrise. All rights reserved. +// + +#import +#import + +@interface BitriseSampleUnitAndOtherTestsAppTests : XCTestCase + +@end + +@implementation BitriseSampleUnitAndOtherTestsAppTests + +- (void)setUp { + [super setUp]; + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; +} + +- (void)testExample { + // This is an example of a functional test case. + XCTAssert(YES, @"Pass"); +} + +- (void)testPerformanceExample { + // This is an example of a performance test case. + [self measureBlock:^{ + // Put the code you want to measure the time of here. + }]; +} + +@end diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsAppTests/Info.plist b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsAppTests/Info.plist new file mode 100644 index 00000000..a13b0ec4 --- /dev/null +++ b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsAppTests/Info.plist @@ -0,0 +1,24 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + com.bitrise.$(PRODUCT_NAME:rfc1034identifier) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsAppTests/KiwiSampleSpec.m b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsAppTests/KiwiSampleSpec.m new file mode 100644 index 00000000..93cb7616 --- /dev/null +++ b/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsAppTests/KiwiSampleSpec.m @@ -0,0 +1,21 @@ +// +// KiwiSampleSpec.m +// BitriseSampleUnitAndOtherTestsApp +// +// Created by Viktor Benei on 3/3/15. +// Copyright (c) 2015 Bitrise. All rights reserved. +// + +#import "Kiwi.h" + +SPEC_BEGIN(KiwiSampleSpec) + +describe(@"KiwiSample", ^{ + it(@"is pretty cool", ^{ + NSUInteger a = 16; + NSUInteger b = 26; + [[theValue(a + b) should] equal:theValue(42)]; + }); +}); + +SPEC_END \ No newline at end of file diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/Podfile.lock b/projects/BitriseSampleUnitAndOtherTestsApp/Podfile.lock new file mode 100644 index 00000000..de629f5c --- /dev/null +++ b/projects/BitriseSampleUnitAndOtherTestsApp/Podfile.lock @@ -0,0 +1,10 @@ +PODS: + - Kiwi (2.3.1) + +DEPENDENCIES: + - Kiwi + +SPEC CHECKSUMS: + Kiwi: f038a6c61f7a9e4d7766bff5717aa3b3fdb75f55 + +COCOAPODS: 0.39.0 diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/fastlane/Fastfile b/projects/BitriseSampleUnitAndOtherTestsApp/fastlane/Fastfile new file mode 100644 index 00000000..c4dcb2e1 --- /dev/null +++ b/projects/BitriseSampleUnitAndOtherTestsApp/fastlane/Fastfile @@ -0,0 +1,45 @@ +# vim: set filetype=ruby: +fastlane_version "1.61.0" +opt_out_usage + +lane :clean do + sh "cd .. && rm -rf build/ BitriseSampleUnitAndOtherTestsApp.xcworkspace/ DerivedData/ Pods/ fastlane/report.xml fastlane/test_output/ compile_commands.json" +end + +platform :ios do + before_all do + # Uncomment to enable auto-install of Xcode and/or auto-detection of DEVELOPER_DIR + #xcode_install(version: "7.2") + cocoapods + end + + lane :test_and_analyze do + # Ensure clean simulator state for tests + sh "killall 'iOS Simulator' 'iPhone Simulator' 'Simulator' || true" + sh "SNAPSHOT_FORCE_DELETE=true snapshot reset_simulators" + + # Run xcodebuild test and analyze actions + scan( + workspace: "BitriseSampleUnitAndOtherTestsApp.xcworkspace", + scheme: "BitriseSampleUnitAndOtherTestsApp", + xcargs: "-derivedDataPath DerivedData analyze", + code_coverage: true, + output_types: "html,junit,json-compilation-database", + output_directory: "build/reports", + ) + end + + lane :oclint do + sh "cd .. && cp build/reports/report.json-compilation-database compile_commands.json" + sh "cd .. && mkdir -p build/reports" + oclint( + select_regex: /BitriseSampleUnitAndOtherTestsApp\/.*/, + report_type: "pmd", + report_path: "build/reports/oclint.xml", + max_priority_1: 10000, + max_priority_2: 10000, + max_priority_3: 10000, + ) + sh "cd .. && rm -f compile_commands.json" + end +end diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/fastlane/README.md b/projects/BitriseSampleUnitAndOtherTestsApp/fastlane/README.md new file mode 100644 index 00000000..8c1dd45b --- /dev/null +++ b/projects/BitriseSampleUnitAndOtherTestsApp/fastlane/README.md @@ -0,0 +1,32 @@ +fastlane documentation +================ +# Installation +``` +sudo gem install fastlane +``` +# Available Actions +### clean +``` +fastlane clean +``` + + +---- + +## iOS +### ios test_and_analyze +``` +fastlane ios test_and_analyze +``` + +### ios oclint +``` +fastlane ios oclint +``` + + +---- + +This README.md is auto-generated and will be re-generated every time to run [fastlane](https://fastlane.tools). +More information about fastlane can be found on [https://fastlane.tools](https://fastlane.tools). +The documentation of fastlane can be found on [GitHub](https://github.com/fastlane/fastlane). \ No newline at end of file diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/podfile b/projects/BitriseSampleUnitAndOtherTestsApp/podfile new file mode 100644 index 00000000..7ee6118f --- /dev/null +++ b/projects/BitriseSampleUnitAndOtherTestsApp/podfile @@ -0,0 +1,16 @@ +# Podfile + +# Select the appropriate platform below +# Specify the minimum supported iOS version (or later) required by Kiwi +platform :ios, '8.0' +# platform :osx + +# +# Some other entries might already exist in the file +# ... +# + +# Add Kiwi as an exclusive dependency for the Tests target +target :BitriseSampleUnitAndOtherTestsAppTests, :exclusive => true do + pod 'Kiwi' +end From 9fbd71764ced65c69f2cd92208abd299695822df Mon Sep 17 00:00:00 2001 From: Matthew DeTullio Date: Sun, 6 Mar 2016 00:31:58 -0500 Subject: [PATCH 35/42] Restructure project for ITs --- README.md | 5 - build-and-deploy.sh | 24 -- its/plugin/pom.xml | 32 +++ .../.gitignore | 1 + .../project.pbxproj | 0 .../contents.xcworkspacedata | 0 ...triseSampleUnitAndOtherTestsApp.xccheckout | 0 ...BitriseSampleUnitAndOtherTestsApp.xcscheme | 0 .../AppDelegate.h | 0 .../AppDelegate.m | 0 .../Base.lproj/LaunchScreen.xib | 0 .../Base.lproj/Main.storyboard | 0 .../.xccurrentversion | 0 .../contents | 0 .../AppIcon.appiconset/Contents.json | 0 .../Info.plist | 0 .../ViewController.h | 0 .../ViewController.m | 0 .../BitriseSampleUnitAndOtherTestsApp/main.m | 0 .../BitriseSampleUnitAndOtherTestsAppTests.m | 0 .../Info.plist | 0 .../KiwiSampleSpec.m | 0 .../Podfile.lock | 0 .../fastlane/Fastfile | 21 +- .../fastlane/README.md | 0 .../BitriseSampleUnitAndOtherTestsApp/podfile | 0 .../sonar-project.properties | 6 + its/plugin/tests/pom.xml | 62 ++++++ .../sonar/its/objectivec/ObjectiveCTest.java | 75 +++++++ .../java/org/sonar/its/objectivec/Tests.java | 57 +++++ its/pom.xml | 23 ++ pom.xml | 207 +++++++++--------- sample/screen shot SonarQube dashboard.png | Bin 97620 -> 0 bytes sample/sonar-project.properties | 65 ------ sonar-objective-c-plugin/pom.xml | 89 ++++++++ .../objectivec/ObjectiveCAstScanner.java | 13 +- .../objectivec/ObjectiveCConfiguration.java | 13 +- .../objectivec/api/ObjectiveCGrammar.java | 13 +- .../objectivec/api/ObjectiveCKeyword.java | 13 +- .../objectivec/api/ObjectiveCMetric.java | 13 +- .../objectivec/api/ObjectiveCPunctuator.java | 13 +- .../objectivec/api/ObjectiveCTokenType.java | 13 +- .../sonar/objectivec/api/package-info.java | 13 +- .../sonar/objectivec/checks/CheckList.java | 13 +- .../sonar/objectivec/checks/package-info.java | 13 +- .../objectivec/lexer/ObjectiveCLexer.java | 13 +- .../sonar/objectivec/lexer/package-info.java | 13 +- .../org/sonar/objectivec/package-info.java | 13 +- .../parser/ObjectiveCGrammarImpl.java | 13 +- .../objectivec/parser/ObjectiveCParser.java | 13 +- .../sonar/objectivec/parser/package-info.java | 13 +- .../sonar/plugins/objectivec/ObjectiveC.java | 13 +- .../objectivec/ObjectiveCColorizerFormat.java | 13 +- .../objectivec/ObjectiveCCpdMapping.java | 13 +- .../plugins/objectivec/ObjectiveCPlugin.java | 13 +- .../plugins/objectivec/ObjectiveCProfile.java | 13 +- .../objectivec/ObjectiveCSquidSensor.java | 13 +- .../objectivec/ObjectiveCTokenizer.java | 13 +- .../objectivec/clang/ClangPlistParser.java | 13 +- .../objectivec/clang/ClangProfile.java | 13 +- .../clang/ClangProfileImporter.java | 13 +- .../clang/ClangRulesDefinition.java | 13 +- .../plugins/objectivec/clang/ClangSensor.java | 13 +- .../objectivec/clang/ClangWarning.java | 13 +- .../objectivec/clang/package-info.java | 13 +- .../cobertura/CoberturaReportParser.java | 13 +- .../objectivec/cobertura/CoberturaSensor.java | 13 +- .../objectivec/cobertura/package-info.java | 13 +- .../objectivec/lizard/LizardReportParser.java | 13 +- .../objectivec/lizard/LizardSensor.java | 13 +- .../objectivec/lizard/package-info.java | 13 +- .../objectivec/oclint/OCLintParser.java | 13 +- .../objectivec/oclint/OCLintProfile.java | 13 +- .../oclint/OCLintProfileImporter.java | 13 +- .../oclint/OCLintRulesDefinition.java | 13 +- .../objectivec/oclint/OCLintSensor.java | 13 +- .../objectivec/oclint/package-info.java | 13 +- .../plugins/objectivec/package-info.java | 13 +- .../objectivec/surefire/SurefireParser.java | 13 +- .../objectivec/surefire/SurefireSensor.java | 13 +- .../surefire/data/SurefireStaxHandler.java | 13 +- .../surefire/data/UnitTestClassReport.java | 13 +- .../surefire/data/UnitTestIndex.java | 13 +- .../surefire/data/UnitTestResult.java | 13 +- .../surefire/data/package-info.java | 13 +- .../objectivec/surefire/package-info.java | 13 +- .../resources/com/sonar/sqale/clang-model.xml | 0 .../com/sonar/sqale/oclint-model.xml | 0 .../plugins/objectivec/profile-clang.xml | 0 .../plugins/objectivec/profile-oclint.xml | 0 .../sonar/plugins/objectivec/rules-clang.xml | 0 .../sonar/plugins/objectivec/rules-oclint.xml | 0 .../objectivec/ObjectiveCAstScannerTest.java | 13 +- .../api/ObjectiveCPunctuatorTest.java | 13 +- .../objectivec/lexer/ObjectiveCLexerTest.java | 13 +- .../lizard/LizardReportParserTest.java | 13 +- .../objectivec/oclint/ProjectBuilder.java | 13 +- .../src}/test/resources/Profile.m | 0 .../src}/test/resources/objcSample.h | 0 .../updateRules.groovy | 0 100 files changed, 804 insertions(+), 591 deletions(-) delete mode 100755 build-and-deploy.sh create mode 100644 its/plugin/pom.xml rename {projects => its/plugin/projects}/BitriseSampleUnitAndOtherTestsApp/.gitignore (96%) rename {projects => its/plugin/projects}/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/project.pbxproj (100%) rename {projects => its/plugin/projects}/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata (100%) rename {projects => its/plugin/projects}/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/project.xcworkspace/xcshareddata/BitriseSampleUnitAndOtherTestsApp.xccheckout (100%) rename {projects => its/plugin/projects}/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/xcshareddata/xcschemes/BitriseSampleUnitAndOtherTestsApp.xcscheme (100%) rename {projects => its/plugin/projects}/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/AppDelegate.h (100%) rename {projects => its/plugin/projects}/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/AppDelegate.m (100%) rename {projects => its/plugin/projects}/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Base.lproj/LaunchScreen.xib (100%) rename {projects => its/plugin/projects}/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Base.lproj/Main.storyboard (100%) rename {projects => its/plugin/projects}/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcdatamodeld/.xccurrentversion (100%) rename {projects => its/plugin/projects}/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcdatamodeld/BitriseSampleUnitAndOtherTestsApp.xcdatamodel/contents (100%) rename {projects => its/plugin/projects}/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Images.xcassets/AppIcon.appiconset/Contents.json (100%) rename {projects => its/plugin/projects}/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Info.plist (100%) rename {projects => its/plugin/projects}/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/ViewController.h (100%) rename {projects => its/plugin/projects}/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/ViewController.m (100%) rename {projects => its/plugin/projects}/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/main.m (100%) rename {projects => its/plugin/projects}/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsAppTests/BitriseSampleUnitAndOtherTestsAppTests.m (100%) rename {projects => its/plugin/projects}/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsAppTests/Info.plist (100%) rename {projects => its/plugin/projects}/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsAppTests/KiwiSampleSpec.m (100%) rename {projects => its/plugin/projects}/BitriseSampleUnitAndOtherTestsApp/Podfile.lock (100%) rename {projects => its/plugin/projects}/BitriseSampleUnitAndOtherTestsApp/fastlane/Fastfile (58%) rename {projects => its/plugin/projects}/BitriseSampleUnitAndOtherTestsApp/fastlane/README.md (100%) rename {projects => its/plugin/projects}/BitriseSampleUnitAndOtherTestsApp/podfile (100%) create mode 100644 its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/sonar-project.properties create mode 100644 its/plugin/tests/pom.xml create mode 100644 its/plugin/tests/src/test/java/org/sonar/its/objectivec/ObjectiveCTest.java create mode 100644 its/plugin/tests/src/test/java/org/sonar/its/objectivec/Tests.java create mode 100644 its/pom.xml delete mode 100644 sample/screen shot SonarQube dashboard.png delete mode 100644 sample/sonar-project.properties create mode 100644 sonar-objective-c-plugin/pom.xml rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java (92%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java (77%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/objectivec/api/ObjectiveCGrammar.java (75%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java (92%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java (78%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java (85%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java (73%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/objectivec/api/package-info.java (67%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/objectivec/checks/CheckList.java (74%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/objectivec/checks/package-info.java (67%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java (83%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/objectivec/lexer/package-info.java (67%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/objectivec/package-info.java (66%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/objectivec/parser/ObjectiveCGrammarImpl.java (74%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java (78%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/objectivec/parser/package-info.java (67%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/ObjectiveC.java (86%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/ObjectiveCColorizerFormat.java (83%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/ObjectiveCCpdMapping.java (78%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java (93%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/ObjectiveCProfile.java (80%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java (95%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/ObjectiveCTokenizer.java (84%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/clang/ClangPlistParser.java (92%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/clang/ClangProfile.java (84%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/clang/ClangProfileImporter.java (84%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java (89%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/clang/ClangSensor.java (92%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/clang/ClangWarning.java (79%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/clang/package-info.java (67%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaReportParser.java (93%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaSensor.java (87%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/cobertura/package-info.java (67%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/lizard/LizardReportParser.java (96%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java (91%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/lizard/package-info.java (67%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/oclint/OCLintParser.java (92%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java (85%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfileImporter.java (84%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/oclint/OCLintRulesDefinition.java (82%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/oclint/OCLintSensor.java (87%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/oclint/package-info.java (67%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/package-info.java (67%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java (95%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java (88%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/surefire/data/SurefireStaxHandler.java (94%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestClassReport.java (88%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestIndex.java (86%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestResult.java (86%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/surefire/data/package-info.java (67%) rename {src => sonar-objective-c-plugin/src}/main/java/org/sonar/plugins/objectivec/surefire/package-info.java (67%) rename {src => sonar-objective-c-plugin/src}/main/resources/com/sonar/sqale/clang-model.xml (100%) rename {src => sonar-objective-c-plugin/src}/main/resources/com/sonar/sqale/oclint-model.xml (100%) rename {src => sonar-objective-c-plugin/src}/main/resources/org/sonar/plugins/objectivec/profile-clang.xml (100%) rename {src => sonar-objective-c-plugin/src}/main/resources/org/sonar/plugins/objectivec/profile-oclint.xml (100%) rename {src => sonar-objective-c-plugin/src}/main/resources/org/sonar/plugins/objectivec/rules-clang.xml (100%) rename {src => sonar-objective-c-plugin/src}/main/resources/org/sonar/plugins/objectivec/rules-oclint.xml (100%) rename {src => sonar-objective-c-plugin/src}/test/java/org/sonar/objectivec/ObjectiveCAstScannerTest.java (83%) rename {src => sonar-objective-c-plugin/src}/test/java/org/sonar/objectivec/api/ObjectiveCPunctuatorTest.java (71%) rename {src => sonar-objective-c-plugin/src}/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java (87%) rename {src => sonar-objective-c-plugin/src}/test/java/org/sonar/plugins/objectivec/lizard/LizardReportParserTest.java (96%) rename {src => sonar-objective-c-plugin/src}/test/java/org/sonar/plugins/objectivec/oclint/ProjectBuilder.java (80%) rename {src => sonar-objective-c-plugin/src}/test/resources/Profile.m (100%) rename {src => sonar-objective-c-plugin/src}/test/resources/objcSample.h (100%) rename updateRules.groovy => sonar-objective-c-plugin/updateRules.groovy (100%) diff --git a/README.md b/README.md index 7a335458..4b8ec8dd 100644 --- a/README.md +++ b/README.md @@ -14,11 +14,6 @@ If you wish to contribute, check the [Contributing](https://github.com/octo-technology/sonar-objective-c/wiki/Contributing) wiki page. -Find below an example of an iOS SonarQube dashboard: -

- Example iOS SonarQube dashboard -

- ## Features - [x] Complexity diff --git a/build-and-deploy.sh b/build-and-deploy.sh deleted file mode 100755 index f2e7c47b..00000000 --- a/build-and-deploy.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/sh -# Build and install snapshot plugin in Sonar - -# Build first and check status -mvn clean install -if [ "$?" != 0 ]; then - echo "ERROR - Java build failed!" 1>&2 - exit $? -fi - -# Run shell tests -#shelltest src/test/shell --execdir --diff -#if [ "$?" != 0 ]; then -# echo "ERROR - Shell tests failed!" 1>&2 -# exit $? -#fi - -# Deploy new verion of plugin in Sonar dir -cp target/*.jar $SONARQUBE_HOME/extensions/plugins - -# Stop/start Sonar -$SONARQUBE_HOME/bin/macosx-universal-64/sonar.sh stop -$SONARQUBE_HOME/bin/macosx-universal-64/sonar.sh start - diff --git a/its/plugin/pom.xml b/its/plugin/pom.xml new file mode 100644 index 00000000..2a092b7b --- /dev/null +++ b/its/plugin/pom.xml @@ -0,0 +1,32 @@ + + + 4.0.0 + + + org.sonarqubecommunity.objectivec + objective-c-its + 0.5.0-SNAPSHOT + + + objective-c-its-plugin + + SonarQube Objective-C (Community) :: ITs :: Plugin + pom + + + false + + + + tests + + + + + it-plugin + + false + + + + diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/.gitignore b/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/.gitignore similarity index 96% rename from projects/BitriseSampleUnitAndOtherTestsApp/.gitignore rename to its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/.gitignore index 703a6680..f076e756 100644 --- a/projects/BitriseSampleUnitAndOtherTestsApp/.gitignore +++ b/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/.gitignore @@ -6,6 +6,7 @@ Pods DerivedData *.build build +.sonar compile_commands.json # Fastlane reports fastlane/report.xml diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/project.pbxproj b/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/project.pbxproj similarity index 100% rename from projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/project.pbxproj rename to its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/project.pbxproj diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata similarity index 100% rename from projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata rename to its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/project.xcworkspace/contents.xcworkspacedata diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/project.xcworkspace/xcshareddata/BitriseSampleUnitAndOtherTestsApp.xccheckout b/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/project.xcworkspace/xcshareddata/BitriseSampleUnitAndOtherTestsApp.xccheckout similarity index 100% rename from projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/project.xcworkspace/xcshareddata/BitriseSampleUnitAndOtherTestsApp.xccheckout rename to its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/project.xcworkspace/xcshareddata/BitriseSampleUnitAndOtherTestsApp.xccheckout diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/xcshareddata/xcschemes/BitriseSampleUnitAndOtherTestsApp.xcscheme b/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/xcshareddata/xcschemes/BitriseSampleUnitAndOtherTestsApp.xcscheme similarity index 100% rename from projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/xcshareddata/xcschemes/BitriseSampleUnitAndOtherTestsApp.xcscheme rename to its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcodeproj/xcshareddata/xcschemes/BitriseSampleUnitAndOtherTestsApp.xcscheme diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/AppDelegate.h b/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/AppDelegate.h similarity index 100% rename from projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/AppDelegate.h rename to its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/AppDelegate.h diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/AppDelegate.m b/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/AppDelegate.m similarity index 100% rename from projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/AppDelegate.m rename to its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/AppDelegate.m diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Base.lproj/LaunchScreen.xib b/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Base.lproj/LaunchScreen.xib similarity index 100% rename from projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Base.lproj/LaunchScreen.xib rename to its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Base.lproj/LaunchScreen.xib diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Base.lproj/Main.storyboard b/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Base.lproj/Main.storyboard similarity index 100% rename from projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Base.lproj/Main.storyboard rename to its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Base.lproj/Main.storyboard diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcdatamodeld/.xccurrentversion b/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcdatamodeld/.xccurrentversion similarity index 100% rename from projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcdatamodeld/.xccurrentversion rename to its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcdatamodeld/.xccurrentversion diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcdatamodeld/BitriseSampleUnitAndOtherTestsApp.xcdatamodel/contents b/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcdatamodeld/BitriseSampleUnitAndOtherTestsApp.xcdatamodel/contents similarity index 100% rename from projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcdatamodeld/BitriseSampleUnitAndOtherTestsApp.xcdatamodel/contents rename to its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp.xcdatamodeld/BitriseSampleUnitAndOtherTestsApp.xcdatamodel/contents diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Images.xcassets/AppIcon.appiconset/Contents.json b/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Images.xcassets/AppIcon.appiconset/Contents.json similarity index 100% rename from projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Images.xcassets/AppIcon.appiconset/Contents.json rename to its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Images.xcassets/AppIcon.appiconset/Contents.json diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Info.plist b/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Info.plist similarity index 100% rename from projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Info.plist rename to its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/Info.plist diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/ViewController.h b/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/ViewController.h similarity index 100% rename from projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/ViewController.h rename to its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/ViewController.h diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/ViewController.m b/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/ViewController.m similarity index 100% rename from projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/ViewController.m rename to its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/ViewController.m diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/main.m b/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/main.m similarity index 100% rename from projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/main.m rename to its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsApp/main.m diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsAppTests/BitriseSampleUnitAndOtherTestsAppTests.m b/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsAppTests/BitriseSampleUnitAndOtherTestsAppTests.m similarity index 100% rename from projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsAppTests/BitriseSampleUnitAndOtherTestsAppTests.m rename to its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsAppTests/BitriseSampleUnitAndOtherTestsAppTests.m diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsAppTests/Info.plist b/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsAppTests/Info.plist similarity index 100% rename from projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsAppTests/Info.plist rename to its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsAppTests/Info.plist diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsAppTests/KiwiSampleSpec.m b/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsAppTests/KiwiSampleSpec.m similarity index 100% rename from projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsAppTests/KiwiSampleSpec.m rename to its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/BitriseSampleUnitAndOtherTestsAppTests/KiwiSampleSpec.m diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/Podfile.lock b/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/Podfile.lock similarity index 100% rename from projects/BitriseSampleUnitAndOtherTestsApp/Podfile.lock rename to its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/Podfile.lock diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/fastlane/Fastfile b/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/fastlane/Fastfile similarity index 58% rename from projects/BitriseSampleUnitAndOtherTestsApp/fastlane/Fastfile rename to its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/fastlane/Fastfile index c4dcb2e1..750b1937 100644 --- a/projects/BitriseSampleUnitAndOtherTestsApp/fastlane/Fastfile +++ b/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/fastlane/Fastfile @@ -3,7 +3,13 @@ fastlane_version "1.61.0" opt_out_usage lane :clean do - sh "cd .. && rm -rf build/ BitriseSampleUnitAndOtherTestsApp.xcworkspace/ DerivedData/ Pods/ fastlane/report.xml fastlane/test_output/ compile_commands.json" + sh "cd .. && rm -rf build/" + sh "cd .. && rm -rf BitriseSampleUnitAndOtherTestsApp.xcworkspace/" + sh "cd .. && rm -rf DerivedData/" + sh "cd .. && rm -rf Pods/" + sh "cd .. && rm -f fastlane/report.xml" + sh "cd .. && rm -rf fastlane/test_output/" + sh "cd .. && rm -f compile_commands.json" end platform :ios do @@ -22,11 +28,18 @@ platform :ios do scan( workspace: "BitriseSampleUnitAndOtherTestsApp.xcworkspace", scheme: "BitriseSampleUnitAndOtherTestsApp", - xcargs: "-derivedDataPath DerivedData analyze", + xcargs: "-derivedDataPath DerivedData analyze CLANG_ANALYZER_OUTPUT_DIR=#{Dir.pwd}/../build/reports/clang/", code_coverage: true, output_types: "html,junit,json-compilation-database", output_directory: "build/reports", ) + + # Don't keep analysis on Pods + sh "cd .. && rm -rf build/reports/clang/StaticAnalyzer/Pods/" + + # Move JUnit reports into their own directory and make files match naming standard + sh "cd .. && mkdir build/reports/junit/" + sh "cd .. && mv build/reports/report.junit build/reports/junit/TESTS-BitriseSampleUnitAndOtherTestsApp.xml" end lane :oclint do @@ -42,4 +55,8 @@ platform :ios do ) sh "cd .. && rm -f compile_commands.json" end + + lane :lizard do + sh "cd .. && lizard --xml BitriseSampleUnitAndOtherTestsApp/ > build/reports/lizard.xml" + end end diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/fastlane/README.md b/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/fastlane/README.md similarity index 100% rename from projects/BitriseSampleUnitAndOtherTestsApp/fastlane/README.md rename to its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/fastlane/README.md diff --git a/projects/BitriseSampleUnitAndOtherTestsApp/podfile b/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/podfile similarity index 100% rename from projects/BitriseSampleUnitAndOtherTestsApp/podfile rename to its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/podfile diff --git a/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/sonar-project.properties b/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/sonar-project.properties new file mode 100644 index 00000000..5b7946b4 --- /dev/null +++ b/its/plugin/projects/BitriseSampleUnitAndOtherTestsApp/sonar-project.properties @@ -0,0 +1,6 @@ +sonar.projectKey=BitriseSampleUnitAndOtherTestsApp +sonar.projectName=BitriseSampleUnitAndOtherTestsApp +sonar.projectVersion=1.0 + +sonar.sources=BitriseSampleUnitAndOtherTestsApp +sonar.tests=BitriseSampleUnitAndOtherTestsAppTests diff --git a/its/plugin/tests/pom.xml b/its/plugin/tests/pom.xml new file mode 100644 index 00000000..b44c97f1 --- /dev/null +++ b/its/plugin/tests/pom.xml @@ -0,0 +1,62 @@ + + + 4.0.0 + + + org.sonarqubecommunity.objectivec + objective-c-its-plugin + 0.5.0-SNAPSHOT + + + objective-c-its-plugin-tests + SonarQube Objective-C (Community) :: ITs :: Plugin :: Tests + + + true + + + + + org.sonarsource.orchestrator + sonar-orchestrator + ${orchestrator.version} + test + + + com.oracle + ojdbc6 + + + + + org.codehaus.sonar + sonar-plugin-api + test + + + junit + junit + test + + + org.easytesting + fest-assert + test + + + + + + + + maven-surefire-plugin + + + org/sonar/its/objectivec/Tests.java + + + + + + + diff --git a/its/plugin/tests/src/test/java/org/sonar/its/objectivec/ObjectiveCTest.java b/its/plugin/tests/src/test/java/org/sonar/its/objectivec/ObjectiveCTest.java new file mode 100644 index 00000000..79436858 --- /dev/null +++ b/its/plugin/tests/src/test/java/org/sonar/its/objectivec/ObjectiveCTest.java @@ -0,0 +1,75 @@ +/* + * SonarQube Objective-C (Community) :: ITs :: Plugin :: Tests + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.its.objectivec; + +import com.sonar.orchestrator.Orchestrator; +import com.sonar.orchestrator.build.SonarScanner; +import org.junit.BeforeClass; +import org.junit.ClassRule; +import org.junit.Test; +import org.sonar.wsclient.Sonar; +import org.sonar.wsclient.services.Measure; +import org.sonar.wsclient.services.Resource; +import org.sonar.wsclient.services.ResourceQuery; + +import java.io.IOException; +import java.net.URISyntaxException; + +import static org.fest.assertions.Assertions.assertThat; + +public class ObjectiveCTest { + private static final String PROJECT_KEY = "BitriseSampleUnitAndOtherTestsApp"; + private static final String SRC_DIR_NAME = "BitriseSampleUnitAndOtherTestsApp"; + + @ClassRule + public static Orchestrator orchestrator = Tests.ORCHESTRATOR; + + private static Sonar sonar; + + @BeforeClass + public static void startServer() throws IOException, URISyntaxException { + sonar = orchestrator.getServer().getWsClient(); + } + + @Test + public void testSimpleBuild() { + SonarScanner scanner = SonarScanner.create() + .setProjectDir(Tests.projectDirectoryFor(PROJECT_KEY)); + orchestrator.executeBuild(scanner); + + assertThat(getResourceMeasure(PROJECT_KEY, "files").getValue()).isEqualTo(5); + assertThat(getResourceMeasure(getResourceKey(PROJECT_KEY, "main.m"), "lines").getValue()).isGreaterThan(1); + assertThat(getResource(getResourceKey(PROJECT_KEY, "DoesNotExist.m"))).isNull(); + } + + private String getResourceKey(String projectKey, String fileName) { + return projectKey + ":" + SRC_DIR_NAME + "/" + fileName; + } + + private Resource getResource(String resourceKey) { + return sonar.find(ResourceQuery.create(resourceKey)); + } + + private Measure getResourceMeasure(String resourceKey, String metricKey) { + Resource resource = sonar.find(ResourceQuery.createForMetrics(resourceKey, metricKey.trim())); + assertThat(resource).isNotNull(); + return resource.getMeasure(metricKey.trim()); + } +} diff --git a/its/plugin/tests/src/test/java/org/sonar/its/objectivec/Tests.java b/its/plugin/tests/src/test/java/org/sonar/its/objectivec/Tests.java new file mode 100644 index 00000000..1f60cd73 --- /dev/null +++ b/its/plugin/tests/src/test/java/org/sonar/its/objectivec/Tests.java @@ -0,0 +1,57 @@ +/* + * SonarQube Objective-C (Community) :: ITs :: Plugin :: Tests + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.its.objectivec; + +import com.sonar.orchestrator.Orchestrator; +import com.sonar.orchestrator.OrchestratorBuilder; +import com.sonar.orchestrator.locator.FileLocation; +import org.junit.ClassRule; +import org.junit.runner.RunWith; +import org.junit.runners.Suite; + +import java.io.File; + +@RunWith(Suite.class) +@Suite.SuiteClasses({ + ObjectiveCTest.class +}) +public class Tests { + + public static final String PROJECT_ROOT_DIR = "../projects/"; + private static final String PLUGIN_KEY = "objectivec"; + + @ClassRule + public static final Orchestrator ORCHESTRATOR; + + static { + OrchestratorBuilder orchestratorBuilder = Orchestrator.builderEnv() + .addPlugin(FileLocation.byWildcardMavenFilename( + new File("../../../sonar-objective-c-plugin/target"), "sonar-objective-c-plugin-*.jar")); + ORCHESTRATOR = orchestratorBuilder.build(); + } + + public static boolean is_after_plugin(String version) { + return ORCHESTRATOR.getConfiguration().getPluginVersion(PLUGIN_KEY).isGreaterThanOrEquals(version); + } + + public static File projectDirectoryFor(String projectDirName) { + return new File(Tests.PROJECT_ROOT_DIR + projectDirName + "/"); + } +} \ No newline at end of file diff --git a/its/pom.xml b/its/pom.xml new file mode 100644 index 00000000..f01b8d6f --- /dev/null +++ b/its/pom.xml @@ -0,0 +1,23 @@ + + + 4.0.0 + + + org.sonarqubecommunity.objectivec + objective-c + 0.5.0-SNAPSHOT + + + objective-c-its + SonarQube Objective-C (Community) :: ITs + pom + + + plugin + + + + true + true + + diff --git a/pom.xml b/pom.xml index 41949ea3..6160e5dd 100644 --- a/pom.xml +++ b/pom.xml @@ -5,22 +5,19 @@ org.sonarsource.parent parent - 23 + 29 - org.codehaus.sonar-plugin.objectivec - sonar-objective-c-plugin + org.sonarqubecommunity.objectivec + objective-c 0.5.0-SNAPSHOT - sonar-plugin - - SonarQube Objective-C (Community) Plugin - Enable analysis and reporting on Objective-C projects. - https://github.com/octo-technology/sonar-objective-c - + pom + SonarQube Objective-C (Community) 2012 - OCTO Technology + OCTO Technology, Backelite, and contributors + mailto:sonarqube@googlegroups.com @@ -30,6 +27,11 @@ + + sonar-objective-c-plugin + its + + cyrilpicat @@ -73,108 +75,107 @@ https://github.com/mjdetullio + - scm:git:git@github.com:octo-technology/sonar-objective-c.git - scm:git:git@github.com:octo-technology/sonar-objective-c.git - https://github.com/octo-technology/sonar-objective-c + scm:git:git@github.com:mjdetullio/sonar-objective-c.git + scm:git:git@github.com:mjdetullio/sonar-objective-c.git + https://github.com/mjdetullio/sonar-objective-c + + GitHub + https://github.com/mjdetullio/sonar-objective-c/issues + + - Cloudbees - https://rfelden.ci.cloudbees.com/job/sonar-objective-c/ + Travis CI + https://travis-ci.org/mjdetullio/sonar-objective-c - OCTO Technology, Backelite, SonarSource, - Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - - SonarQube Objective-C Plugin - - true - + ${project.organization.name} + ${project.organization.url} 4.3 1.20 - - - org.sonar.plugins.objectivec.ObjectiveCPlugin - Objective-C (Community) - + 3.10.1 - - - org.codehaus.sonar - sonar-plugin-api - ${sonar.version} - provided - - - org.codehaus.sonar.sslr - sslr-core - ${sslr.version} - - - org.codehaus.sonar.sslr - sslr-xpath - ${sslr.version} - - - org.codehaus.sonar.sslr - sslr-toolkit - ${sslr.version} - - - org.codehaus.sonar.sslr-squid-bridge - sslr-squid-bridge - 2.5.3 - - - com.googlecode.plist - dd-plist - 1.16 - - - - org.codehaus.sonar - sonar-testing-harness - ${sonar.version} - test - - - org.codehaus.sonar.sslr - sslr-testing-harness - ${sslr.version} - test - - - junit - junit - 4.10 - test - - - org.mockito - mockito-all - 1.9.0 - test - - - org.hamcrest - hamcrest-all - 1.1 - test - - - org.easytesting - fest-assert - 1.4 - test - - - ch.qos.logback - logback-classic - 1.1.3 - test - - + + + + org.codehaus.sonar + sonar-plugin-api + ${sonar.version} + provided + + + org.codehaus.sonar.sslr + sslr-core + ${sslr.version} + + + org.codehaus.sonar.sslr + sslr-xpath + ${sslr.version} + + + org.codehaus.sonar.sslr + sslr-toolkit + ${sslr.version} + + + org.codehaus.sonar.sslr-squid-bridge + sslr-squid-bridge + 2.5.3 + + + com.googlecode.plist + dd-plist + 1.16 + + + + org.codehaus.sonar + sonar-testing-harness + ${sonar.version} + test + + + org.codehaus.sonar.sslr + sslr-testing-harness + ${sslr.version} + test + + + junit + junit + 4.10 + test + + + org.mockito + mockito-all + 1.9.0 + test + + + org.hamcrest + hamcrest-all + 1.1 + test + + + org.easytesting + fest-assert + 1.4 + test + + + ch.qos.logback + logback-classic + 1.1.3 + test + + + diff --git a/sample/screen shot SonarQube dashboard.png b/sample/screen shot SonarQube dashboard.png deleted file mode 100644 index c2b72a7c37459beaa81522a31628646a7f563fef..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 97620 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

`z_j=wQrI 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�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 U`RIDES4+3QeU;qFB diff --git a/sample/sonar-project.properties b/sample/sonar-project.properties deleted file mode 100644 index dd3261f4..00000000 --- a/sample/sonar-project.properties +++ /dev/null @@ -1,65 +0,0 @@ -# Required -sonar.projectKey=com.example:my-project -# Required -sonar.projectName=My project -# Required -sonar.projectVersion=1.0 - -# Optional -sonar.projectDescription=Fake description - -# Required -# Path to source directories -sonar.sources=srcDir1,srcDir2 - -# Optional -sonar.inclusions=subDir1/**,subDir2/** -# Optional -sonar.exclusions=**/generatedDir/**,**/thirdpartyDir/** - -# Optional -# Path to test directories -sonar.tests=testSrcDir - -# Optional -sonar.test.inclusions=subDir3/** -# Optional -sonar.test.exclusions= - -# Recommended -# Add language property to limit to single-language analysis -sonar.language=objectivec - -# Define suffixes for multi-language analysis -# There will likely be problems if you have any other C/C++/Obj-C plugin(s) installed due to each language using .h files -sonar.objectivec.file.suffixes=.h,.m - -# Encoding of the source code -sonar.sourceEncoding=UTF-8 - -# Optional -# Folder with JUnit XML reports matching format of "TEST*.xml" -# Generate this with xctool, xcpretty, or ocunit2junit -sonar.objectivec.junit.reportsPath=sonar-reports/junit - -# Optional -# Path to Cobertura XML report -# Generate this with gcovr (Xcode < 7) or slather (Xcode >= 7) -sonar.objectivec.cobertura.reportPath=sonar-reports/cobertura.xml - -# Optional -# Path to OCLint PMD formatted XML report -sonar.objectivec.oclint.reportPath=sonar-reports/oclint.xml - -# Optional -# Folder with Clang Plist reports matching format of "*.plist" -sonar.objectivec.clang.reportsPath=sonar-reports/clang - -# Optional -# Path to Lizard XML report -sonar.objectivec.lizard.reportPath=sonar-reports/lizard.xml - -# Project SCM settings -# sonar.scm.enabled=true -# sonar.scm.url=scm:git:https://... - diff --git a/sonar-objective-c-plugin/pom.xml b/sonar-objective-c-plugin/pom.xml new file mode 100644 index 00000000..27a351ca --- /dev/null +++ b/sonar-objective-c-plugin/pom.xml @@ -0,0 +1,89 @@ + + 4.0.0 + + + org.sonarqubecommunity.objectivec + objective-c + 0.5.0-SNAPSHOT + + + sonar-objective-c-plugin + sonar-plugin + + SonarQube Objective-C (Community) Plugin + Enable analysis and reporting on Objective-C projects. + https://github.com/mjdetullio/sonar-objective-c + + + true + + + org.sonar.plugins.objectivec.ObjectiveCPlugin + Objective-C (Community) + + + + + org.codehaus.sonar + sonar-plugin-api + provided + + + org.codehaus.sonar.sslr + sslr-core + + + org.codehaus.sonar.sslr + sslr-xpath + + + org.codehaus.sonar.sslr + sslr-toolkit + + + org.codehaus.sonar.sslr-squid-bridge + sslr-squid-bridge + + + com.googlecode.plist + dd-plist + + + + org.codehaus.sonar + sonar-testing-harness + test + + + org.codehaus.sonar.sslr + sslr-testing-harness + test + + + junit + junit + test + + + org.mockito + mockito-all + test + + + org.hamcrest + hamcrest-all + test + + + org.easytesting + fest-assert + test + + + ch.qos.logback + logback-classic + test + + + diff --git a/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java similarity index 92% rename from src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java index e7f2b748..887472ed 100644 --- a/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.objectivec; diff --git a/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java similarity index 77% rename from src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java index a94ab886..0f4c8c43 100644 --- a/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.objectivec; diff --git a/src/main/java/org/sonar/objectivec/api/ObjectiveCGrammar.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCGrammar.java similarity index 75% rename from src/main/java/org/sonar/objectivec/api/ObjectiveCGrammar.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCGrammar.java index f9b03acc..2fafc063 100644 --- a/src/main/java/org/sonar/objectivec/api/ObjectiveCGrammar.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCGrammar.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.objectivec.api; diff --git a/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java similarity index 92% rename from src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java index 9912353c..a06b5e79 100644 --- a/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.objectivec.api; diff --git a/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java similarity index 78% rename from src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java index 70455d92..10e0e975 100644 --- a/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.objectivec.api; diff --git a/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java similarity index 85% rename from src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java index 03606a5f..727fe575 100644 --- a/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.objectivec.api; diff --git a/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java similarity index 73% rename from src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java index 1ac8cb66..80a9c6f7 100644 --- a/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.objectivec.api; diff --git a/src/main/java/org/sonar/objectivec/api/package-info.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/package-info.java similarity index 67% rename from src/main/java/org/sonar/objectivec/api/package-info.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/package-info.java index 7e1b771e..33f68629 100644 --- a/src/main/java/org/sonar/objectivec/api/package-info.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/package-info.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ @ParametersAreNonnullByDefault package org.sonar.objectivec.api; diff --git a/src/main/java/org/sonar/objectivec/checks/CheckList.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/checks/CheckList.java similarity index 74% rename from src/main/java/org/sonar/objectivec/checks/CheckList.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/checks/CheckList.java index a757ae8d..293d5f34 100644 --- a/src/main/java/org/sonar/objectivec/checks/CheckList.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/checks/CheckList.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.objectivec.checks; diff --git a/src/main/java/org/sonar/objectivec/checks/package-info.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/checks/package-info.java similarity index 67% rename from src/main/java/org/sonar/objectivec/checks/package-info.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/checks/package-info.java index e153f9ef..c4dff5c7 100644 --- a/src/main/java/org/sonar/objectivec/checks/package-info.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/checks/package-info.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ @ParametersAreNonnullByDefault package org.sonar.objectivec.checks; diff --git a/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java similarity index 83% rename from src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java index 9da201b9..b1f7c117 100644 --- a/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.objectivec.lexer; diff --git a/src/main/java/org/sonar/objectivec/lexer/package-info.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/package-info.java similarity index 67% rename from src/main/java/org/sonar/objectivec/lexer/package-info.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/package-info.java index c69b45c1..31ac5496 100644 --- a/src/main/java/org/sonar/objectivec/lexer/package-info.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/package-info.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ @ParametersAreNonnullByDefault package org.sonar.objectivec.lexer; diff --git a/src/main/java/org/sonar/objectivec/package-info.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/package-info.java similarity index 66% rename from src/main/java/org/sonar/objectivec/package-info.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/package-info.java index 195f5177..7786918c 100644 --- a/src/main/java/org/sonar/objectivec/package-info.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/package-info.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ @ParametersAreNonnullByDefault package org.sonar.objectivec; diff --git a/src/main/java/org/sonar/objectivec/parser/ObjectiveCGrammarImpl.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/parser/ObjectiveCGrammarImpl.java similarity index 74% rename from src/main/java/org/sonar/objectivec/parser/ObjectiveCGrammarImpl.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/parser/ObjectiveCGrammarImpl.java index adda79f1..91d1eac8 100644 --- a/src/main/java/org/sonar/objectivec/parser/ObjectiveCGrammarImpl.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/parser/ObjectiveCGrammarImpl.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.objectivec.parser; diff --git a/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java similarity index 78% rename from src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java index 7a56850f..985b6517 100644 --- a/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.objectivec.parser; diff --git a/src/main/java/org/sonar/objectivec/parser/package-info.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/parser/package-info.java similarity index 67% rename from src/main/java/org/sonar/objectivec/parser/package-info.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/parser/package-info.java index 72983bee..b84ce086 100644 --- a/src/main/java/org/sonar/objectivec/parser/package-info.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/parser/package-info.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ @ParametersAreNonnullByDefault package org.sonar.objectivec.parser; diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java similarity index 86% rename from src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java index c4e1d286..45d64fbf 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec; diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCColorizerFormat.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCColorizerFormat.java similarity index 83% rename from src/main/java/org/sonar/plugins/objectivec/ObjectiveCColorizerFormat.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCColorizerFormat.java index ef63b091..758997d3 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCColorizerFormat.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCColorizerFormat.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec; diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCCpdMapping.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCCpdMapping.java similarity index 78% rename from src/main/java/org/sonar/plugins/objectivec/ObjectiveCCpdMapping.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCCpdMapping.java index a8e810c7..7519991d 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCCpdMapping.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCCpdMapping.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec; diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java similarity index 93% rename from src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java index 74307b0d..5713bd0a 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec; diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCProfile.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCProfile.java similarity index 80% rename from src/main/java/org/sonar/plugins/objectivec/ObjectiveCProfile.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCProfile.java index ac4ed0f3..c2bac26c 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCProfile.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCProfile.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec; diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java similarity index 95% rename from src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java index 348cdcef..2020c370 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec; diff --git a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCTokenizer.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCTokenizer.java similarity index 84% rename from src/main/java/org/sonar/plugins/objectivec/ObjectiveCTokenizer.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCTokenizer.java index e20c79c2..db8a9834 100644 --- a/src/main/java/org/sonar/plugins/objectivec/ObjectiveCTokenizer.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCTokenizer.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec; diff --git a/src/main/java/org/sonar/plugins/objectivec/clang/ClangPlistParser.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangPlistParser.java similarity index 92% rename from src/main/java/org/sonar/plugins/objectivec/clang/ClangPlistParser.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangPlistParser.java index f1a9b575..51b5c999 100644 --- a/src/main/java/org/sonar/plugins/objectivec/clang/ClangPlistParser.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangPlistParser.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec.clang; diff --git a/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfile.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfile.java similarity index 84% rename from src/main/java/org/sonar/plugins/objectivec/clang/ClangProfile.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfile.java index 1fe5201d..ebc44e45 100644 --- a/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfile.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfile.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec.clang; diff --git a/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfileImporter.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfileImporter.java similarity index 84% rename from src/main/java/org/sonar/plugins/objectivec/clang/ClangProfileImporter.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfileImporter.java index fb843031..415b4ce0 100644 --- a/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfileImporter.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfileImporter.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec.clang; diff --git a/src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java similarity index 89% rename from src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java index 1eb4cda0..e49a31a0 100644 --- a/src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec.clang; diff --git a/src/main/java/org/sonar/plugins/objectivec/clang/ClangSensor.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangSensor.java similarity index 92% rename from src/main/java/org/sonar/plugins/objectivec/clang/ClangSensor.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangSensor.java index c0c1dbcc..fd72ccdc 100644 --- a/src/main/java/org/sonar/plugins/objectivec/clang/ClangSensor.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangSensor.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec.clang; diff --git a/src/main/java/org/sonar/plugins/objectivec/clang/ClangWarning.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangWarning.java similarity index 79% rename from src/main/java/org/sonar/plugins/objectivec/clang/ClangWarning.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangWarning.java index 53740c07..df13099f 100644 --- a/src/main/java/org/sonar/plugins/objectivec/clang/ClangWarning.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangWarning.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec.clang; diff --git a/src/main/java/org/sonar/plugins/objectivec/clang/package-info.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/package-info.java similarity index 67% rename from src/main/java/org/sonar/plugins/objectivec/clang/package-info.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/package-info.java index 8bf64768..a125f638 100644 --- a/src/main/java/org/sonar/plugins/objectivec/clang/package-info.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/package-info.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ @ParametersAreNonnullByDefault package org.sonar.plugins.objectivec.clang; diff --git a/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaReportParser.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaReportParser.java similarity index 93% rename from src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaReportParser.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaReportParser.java index 2bf8eafc..2ad2df70 100644 --- a/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaReportParser.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaReportParser.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec.cobertura; diff --git a/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaSensor.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaSensor.java similarity index 87% rename from src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaSensor.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaSensor.java index 75cc7edb..591d0a18 100644 --- a/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaSensor.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaSensor.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec.cobertura; diff --git a/src/main/java/org/sonar/plugins/objectivec/cobertura/package-info.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/cobertura/package-info.java similarity index 67% rename from src/main/java/org/sonar/plugins/objectivec/cobertura/package-info.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/cobertura/package-info.java index 61dccbb9..011b64a3 100644 --- a/src/main/java/org/sonar/plugins/objectivec/cobertura/package-info.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/cobertura/package-info.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ @ParametersAreNonnullByDefault package org.sonar.plugins.objectivec.cobertura; diff --git a/src/main/java/org/sonar/plugins/objectivec/lizard/LizardReportParser.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardReportParser.java similarity index 96% rename from src/main/java/org/sonar/plugins/objectivec/lizard/LizardReportParser.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardReportParser.java index 16f1fc0c..1dfb233b 100644 --- a/src/main/java/org/sonar/plugins/objectivec/lizard/LizardReportParser.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardReportParser.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec.lizard; diff --git a/src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java similarity index 91% rename from src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java index d817c3e0..5c53f055 100644 --- a/src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec.lizard; diff --git a/src/main/java/org/sonar/plugins/objectivec/lizard/package-info.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/package-info.java similarity index 67% rename from src/main/java/org/sonar/plugins/objectivec/lizard/package-info.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/package-info.java index 9ec785cf..56353b31 100644 --- a/src/main/java/org/sonar/plugins/objectivec/lizard/package-info.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/package-info.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ @ParametersAreNonnullByDefault package org.sonar.plugins.objectivec.lizard; diff --git a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintParser.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintParser.java similarity index 92% rename from src/main/java/org/sonar/plugins/objectivec/oclint/OCLintParser.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintParser.java index c756273f..49bb2f86 100644 --- a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintParser.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintParser.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec.oclint; diff --git a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java similarity index 85% rename from src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java index 5f626b81..e522f5fe 100644 --- a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec.oclint; diff --git a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfileImporter.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfileImporter.java similarity index 84% rename from src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfileImporter.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfileImporter.java index f21b16e1..9a7c8b89 100644 --- a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfileImporter.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfileImporter.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec.oclint; diff --git a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintRulesDefinition.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintRulesDefinition.java similarity index 82% rename from src/main/java/org/sonar/plugins/objectivec/oclint/OCLintRulesDefinition.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintRulesDefinition.java index ededbb89..f310fbc7 100644 --- a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintRulesDefinition.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintRulesDefinition.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec.oclint; diff --git a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintSensor.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintSensor.java similarity index 87% rename from src/main/java/org/sonar/plugins/objectivec/oclint/OCLintSensor.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintSensor.java index 05723e00..161f6a23 100644 --- a/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintSensor.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintSensor.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec.oclint; diff --git a/src/main/java/org/sonar/plugins/objectivec/oclint/package-info.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/package-info.java similarity index 67% rename from src/main/java/org/sonar/plugins/objectivec/oclint/package-info.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/package-info.java index 1e36f16b..bd75b693 100644 --- a/src/main/java/org/sonar/plugins/objectivec/oclint/package-info.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/package-info.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ @ParametersAreNonnullByDefault package org.sonar.plugins.objectivec.oclint; diff --git a/src/main/java/org/sonar/plugins/objectivec/package-info.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/package-info.java similarity index 67% rename from src/main/java/org/sonar/plugins/objectivec/package-info.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/package-info.java index c9bc8f8b..63e03fd3 100644 --- a/src/main/java/org/sonar/plugins/objectivec/package-info.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/package-info.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ @ParametersAreNonnullByDefault package org.sonar.plugins.objectivec; diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java similarity index 95% rename from src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java index 26a5e5f4..fbfb6f3d 100644 --- a/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec.surefire; diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java similarity index 88% rename from src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java index cc26b368..0f7d706c 100644 --- a/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec.surefire; diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/data/SurefireStaxHandler.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/data/SurefireStaxHandler.java similarity index 94% rename from src/main/java/org/sonar/plugins/objectivec/surefire/data/SurefireStaxHandler.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/data/SurefireStaxHandler.java index 983155de..468f06ac 100644 --- a/src/main/java/org/sonar/plugins/objectivec/surefire/data/SurefireStaxHandler.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/data/SurefireStaxHandler.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec.surefire.data; diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestClassReport.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestClassReport.java similarity index 88% rename from src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestClassReport.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestClassReport.java index 0eb30f37..67ef222e 100644 --- a/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestClassReport.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestClassReport.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec.surefire.data; diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestIndex.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestIndex.java similarity index 86% rename from src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestIndex.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestIndex.java index a303ab8d..038cdc18 100644 --- a/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestIndex.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestIndex.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec.surefire.data; diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestResult.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestResult.java similarity index 86% rename from src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestResult.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestResult.java index 4448f77f..c50a3af7 100644 --- a/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestResult.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/data/UnitTestResult.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec.surefire.data; diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/data/package-info.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/data/package-info.java similarity index 67% rename from src/main/java/org/sonar/plugins/objectivec/surefire/data/package-info.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/data/package-info.java index c87279e7..1d8c4969 100644 --- a/src/main/java/org/sonar/plugins/objectivec/surefire/data/package-info.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/data/package-info.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ @ParametersAreNonnullByDefault package org.sonar.plugins.objectivec.surefire.data; diff --git a/src/main/java/org/sonar/plugins/objectivec/surefire/package-info.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/package-info.java similarity index 67% rename from src/main/java/org/sonar/plugins/objectivec/surefire/package-info.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/package-info.java index fd228c49..2050a09d 100644 --- a/src/main/java/org/sonar/plugins/objectivec/surefire/package-info.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/package-info.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ @ParametersAreNonnullByDefault package org.sonar.plugins.objectivec.surefire; diff --git a/src/main/resources/com/sonar/sqale/clang-model.xml b/sonar-objective-c-plugin/src/main/resources/com/sonar/sqale/clang-model.xml similarity index 100% rename from src/main/resources/com/sonar/sqale/clang-model.xml rename to sonar-objective-c-plugin/src/main/resources/com/sonar/sqale/clang-model.xml diff --git a/src/main/resources/com/sonar/sqale/oclint-model.xml b/sonar-objective-c-plugin/src/main/resources/com/sonar/sqale/oclint-model.xml similarity index 100% rename from src/main/resources/com/sonar/sqale/oclint-model.xml rename to sonar-objective-c-plugin/src/main/resources/com/sonar/sqale/oclint-model.xml diff --git a/src/main/resources/org/sonar/plugins/objectivec/profile-clang.xml b/sonar-objective-c-plugin/src/main/resources/org/sonar/plugins/objectivec/profile-clang.xml similarity index 100% rename from src/main/resources/org/sonar/plugins/objectivec/profile-clang.xml rename to sonar-objective-c-plugin/src/main/resources/org/sonar/plugins/objectivec/profile-clang.xml diff --git a/src/main/resources/org/sonar/plugins/objectivec/profile-oclint.xml b/sonar-objective-c-plugin/src/main/resources/org/sonar/plugins/objectivec/profile-oclint.xml similarity index 100% rename from src/main/resources/org/sonar/plugins/objectivec/profile-oclint.xml rename to sonar-objective-c-plugin/src/main/resources/org/sonar/plugins/objectivec/profile-oclint.xml diff --git a/src/main/resources/org/sonar/plugins/objectivec/rules-clang.xml b/sonar-objective-c-plugin/src/main/resources/org/sonar/plugins/objectivec/rules-clang.xml similarity index 100% rename from src/main/resources/org/sonar/plugins/objectivec/rules-clang.xml rename to sonar-objective-c-plugin/src/main/resources/org/sonar/plugins/objectivec/rules-clang.xml diff --git a/src/main/resources/org/sonar/plugins/objectivec/rules-oclint.xml b/sonar-objective-c-plugin/src/main/resources/org/sonar/plugins/objectivec/rules-oclint.xml similarity index 100% rename from src/main/resources/org/sonar/plugins/objectivec/rules-oclint.xml rename to sonar-objective-c-plugin/src/main/resources/org/sonar/plugins/objectivec/rules-oclint.xml diff --git a/src/test/java/org/sonar/objectivec/ObjectiveCAstScannerTest.java b/sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/ObjectiveCAstScannerTest.java similarity index 83% rename from src/test/java/org/sonar/objectivec/ObjectiveCAstScannerTest.java rename to sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/ObjectiveCAstScannerTest.java index cd8beebd..4771bccf 100644 --- a/src/test/java/org/sonar/objectivec/ObjectiveCAstScannerTest.java +++ b/sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/ObjectiveCAstScannerTest.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.objectivec; diff --git a/src/test/java/org/sonar/objectivec/api/ObjectiveCPunctuatorTest.java b/sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/api/ObjectiveCPunctuatorTest.java similarity index 71% rename from src/test/java/org/sonar/objectivec/api/ObjectiveCPunctuatorTest.java rename to sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/api/ObjectiveCPunctuatorTest.java index 24818c34..a451307c 100644 --- a/src/test/java/org/sonar/objectivec/api/ObjectiveCPunctuatorTest.java +++ b/sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/api/ObjectiveCPunctuatorTest.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.objectivec.api; diff --git a/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java b/sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java similarity index 87% rename from src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java rename to sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java index 1d2862df..a2f1c4e3 100644 --- a/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java +++ b/sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.objectivec.lexer; diff --git a/src/test/java/org/sonar/plugins/objectivec/lizard/LizardReportParserTest.java b/sonar-objective-c-plugin/src/test/java/org/sonar/plugins/objectivec/lizard/LizardReportParserTest.java similarity index 96% rename from src/test/java/org/sonar/plugins/objectivec/lizard/LizardReportParserTest.java rename to sonar-objective-c-plugin/src/test/java/org/sonar/plugins/objectivec/lizard/LizardReportParserTest.java index 63a80d96..c1c0e67a 100644 --- a/src/test/java/org/sonar/plugins/objectivec/lizard/LizardReportParserTest.java +++ b/sonar-objective-c-plugin/src/test/java/org/sonar/plugins/objectivec/lizard/LizardReportParserTest.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec.lizard; diff --git a/src/test/java/org/sonar/plugins/objectivec/oclint/ProjectBuilder.java b/sonar-objective-c-plugin/src/test/java/org/sonar/plugins/objectivec/oclint/ProjectBuilder.java similarity index 80% rename from src/test/java/org/sonar/plugins/objectivec/oclint/ProjectBuilder.java rename to sonar-objective-c-plugin/src/test/java/org/sonar/plugins/objectivec/oclint/ProjectBuilder.java index 961ac070..dc67ed09 100644 --- a/src/test/java/org/sonar/plugins/objectivec/oclint/ProjectBuilder.java +++ b/sonar-objective-c-plugin/src/test/java/org/sonar/plugins/objectivec/oclint/ProjectBuilder.java @@ -1,8 +1,7 @@ /* - * SonarQube Objective-C Plugin - * Copyright (C) 2012 OCTO Technology, Backelite, SonarSource, - * Denis Bregeon, Mete Balci, Andrés Gil Herrera, Matthew DeTullio - * sonarqube@googlegroups.com + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -14,9 +13,9 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * - * You should have received a copy of the GNU Lesser General Public - * License along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ package org.sonar.plugins.objectivec.oclint; diff --git a/src/test/resources/Profile.m b/sonar-objective-c-plugin/src/test/resources/Profile.m similarity index 100% rename from src/test/resources/Profile.m rename to sonar-objective-c-plugin/src/test/resources/Profile.m diff --git a/src/test/resources/objcSample.h b/sonar-objective-c-plugin/src/test/resources/objcSample.h similarity index 100% rename from src/test/resources/objcSample.h rename to sonar-objective-c-plugin/src/test/resources/objcSample.h diff --git a/updateRules.groovy b/sonar-objective-c-plugin/updateRules.groovy similarity index 100% rename from updateRules.groovy rename to sonar-objective-c-plugin/updateRules.groovy From a8fca66c0a50fb0959ec8bc6f280f4b54f44eb26 Mon Sep 17 00:00:00 2001 From: Matthew DeTullio Date: Sun, 6 Mar 2016 14:44:35 -0500 Subject: [PATCH 36/42] Bump SonarQube minimum version to 4.5.2 LTS and refactor for deprecation --- README.md | 3 +- pom.xml | 2 +- .../objectivec/ObjectiveCAstScanner.java | 38 +++-- .../objectivec/ObjectiveCConfiguration.java | 1 + .../objectivec/api/ObjectiveCGrammar.java | 25 ++- .../objectivec/api/ObjectiveCKeyword.java | 3 + .../objectivec/api/ObjectiveCMetric.java | 5 + .../objectivec/api/ObjectiveCPunctuator.java | 5 +- .../objectivec/api/ObjectiveCTokenType.java | 3 + .../sonar/objectivec/checks/CheckList.java | 4 +- .../highlighter/SonarComponents.java} | 43 +++--- .../highlighter/SourceFileOffsets.java | 91 +++++++++++ .../highlighter/SyntaxHighlighterVisitor.java | 142 ++++++++++++++++++ .../package-info.java} | 17 +-- .../objectivec/lexer/ObjectiveCLexer.java | 13 +- .../objectivec/parser/ObjectiveCParser.java | 7 +- .../sonar/plugins/objectivec/ObjectiveC.java | 1 + .../objectivec/ObjectiveCColorizerFormat.java | 50 ------ .../objectivec/ObjectiveCCpdMapping.java | 2 + .../plugins/objectivec/ObjectiveCPlugin.java | 4 +- .../objectivec/ObjectiveCSquidSensor.java | 29 ++-- .../objectivec/ObjectiveCTokenizer.java | 1 + .../objectivec/clang/ClangPlistParser.java | 23 ++- .../objectivec/clang/ClangProfile.java | 12 +- .../plugins/objectivec/clang/ClangSensor.java | 11 +- .../cobertura/CoberturaReportParser.java | 24 ++- .../objectivec/cobertura/CoberturaSensor.java | 2 +- .../objectivec/lizard/LizardReportParser.java | 14 +- .../objectivec/lizard/LizardSensor.java | 20 ++- .../objectivec/oclint/OCLintParser.java | 25 +-- .../objectivec/oclint/OCLintProfile.java | 12 +- .../objectivec/oclint/OCLintSensor.java | 4 +- .../objectivec/surefire/SurefireParser.java | 26 +--- .../objectivec/surefire/SurefireSensor.java | 6 +- .../objectivec/lexer/ObjectiveCLexerTest.java | 5 +- 35 files changed, 434 insertions(+), 239 deletions(-) rename sonar-objective-c-plugin/src/{test/java/org/sonar/plugins/objectivec/oclint/ProjectBuilder.java => main/java/org/sonar/objectivec/highlighter/SonarComponents.java} (50%) create mode 100644 sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/SourceFileOffsets.java create mode 100644 sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/SyntaxHighlighterVisitor.java rename sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/{parser/ObjectiveCGrammarImpl.java => highlighter/package-info.java} (67%) delete mode 100644 sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCColorizerFormat.java diff --git a/README.md b/README.md index 4b8ec8dd..5ee83d87 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,8 @@ implemented or pending. ## Compatibility - Use 0.3.x releases for SonarQube < 4.3 -- Use 0.4.0 or later releases for SonarQube >= 4.3 (4.x and 5.x) +- Use 0.4.x releases for SonarQube 4.3 and 4.4 +- Use 0.5.x releases for SonarQube >= 4.5.2 LTS ## Download diff --git a/pom.xml b/pom.xml index 6160e5dd..632b75aa 100644 --- a/pom.xml +++ b/pom.xml @@ -95,7 +95,7 @@ ${project.organization.name} ${project.organization.url} - 4.3 + 4.5.2 1.20 3.10.1 diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java index 887472ed..676d2726 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java @@ -19,9 +19,11 @@ */ package org.sonar.objectivec; +import com.sonar.sslr.api.Grammar; import com.sonar.sslr.impl.Parser; -import org.sonar.objectivec.api.ObjectiveCGrammar; import org.sonar.objectivec.api.ObjectiveCMetric; +import org.sonar.objectivec.highlighter.SonarComponents; +import org.sonar.objectivec.highlighter.SyntaxHighlighterVisitor; import org.sonar.objectivec.parser.ObjectiveCParser; import org.sonar.squidbridge.AstScanner; import org.sonar.squidbridge.CommentAnalyser; @@ -35,22 +37,25 @@ import org.sonar.squidbridge.metrics.LinesOfCodeVisitor; import org.sonar.squidbridge.metrics.LinesVisitor; +import javax.annotation.Nullable; import java.io.File; import java.util.Collection; public class ObjectiveCAstScanner { private ObjectiveCAstScanner() { + // prevents outside instantiation } /** * Helper method for testing checks without having to deploy them on a Sonar instance. */ - public static SourceFile scanSingleFile(File file, SquidAstVisitor... visitors) { + @SafeVarargs + public static SourceFile scanSingleFile(File file, SquidAstVisitor... visitors) { if (!file.isFile()) { throw new IllegalArgumentException("File '" + file + "' not found."); } - AstScanner scanner = create(new ObjectiveCConfiguration(), visitors); + AstScanner scanner = create(new ObjectiveCConfiguration(), null, visitors); scanner.scanFile(file); Collection sources = scanner.getIndex().search(new QueryByType(SourceFile.class)); if (sources.size() != 1) { @@ -59,12 +64,13 @@ public static SourceFile scanSingleFile(File file, SquidAstVisitor create(ObjectiveCConfiguration conf, - SquidAstVisitor... visitors) { - final SquidAstVisitorContextImpl context = new SquidAstVisitorContextImpl(new SourceProject("Objective-C Project")); - final Parser parser = ObjectiveCParser.create(conf); + @SafeVarargs + public static AstScanner create(ObjectiveCConfiguration conf, + @Nullable SonarComponents sonarComponents, SquidAstVisitor... visitors) { + final SquidAstVisitorContextImpl context = new SquidAstVisitorContextImpl<>(new SourceProject("Objective-C Project")); + final Parser parser = ObjectiveCParser.create(conf); - AstScanner.Builder builder = AstScanner.builder(context).setBaseParser(parser); + AstScanner.Builder builder = AstScanner.builder(context).setBaseParser(parser); /* Metrics */ builder.withMetrics(ObjectiveCMetric.values()); @@ -92,13 +98,23 @@ public String getContents(String comment) { builder.setFilesMetric(ObjectiveCMetric.FILES); /* Metrics */ - builder.withSquidAstVisitor(new LinesVisitor(ObjectiveCMetric.LINES)); - builder.withSquidAstVisitor(new LinesOfCodeVisitor(ObjectiveCMetric.LINES_OF_CODE)); - builder.withSquidAstVisitor(CommentsVisitor.builder().withCommentMetric(ObjectiveCMetric.COMMENT_LINES) + builder.withSquidAstVisitor(new LinesVisitor<>(ObjectiveCMetric.LINES)); + builder.withSquidAstVisitor(new LinesOfCodeVisitor<>(ObjectiveCMetric.LINES_OF_CODE)); + builder.withSquidAstVisitor(CommentsVisitor.builder().withCommentMetric(ObjectiveCMetric.COMMENT_LINES) .withNoSonar(true) .withIgnoreHeaderComment(conf.getIgnoreHeaderComments()) .build()); + /* Syntax highlighter */ + if (sonarComponents != null) { + builder.withSquidAstVisitor(new SyntaxHighlighterVisitor(sonarComponents, conf.getCharset())); + } + + /* External visitors */ + for (SquidAstVisitor visitor : visitors) { + builder.withSquidAstVisitor(visitor); + } + return builder.build(); } diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java index 0f4c8c43..89fd3907 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java @@ -28,6 +28,7 @@ public class ObjectiveCConfiguration extends SquidConfiguration { private boolean ignoreHeaderComments; public ObjectiveCConfiguration() { + // no-op } public ObjectiveCConfiguration(Charset charset) { diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCGrammar.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCGrammar.java index 2fafc063..5043dcce 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCGrammar.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCGrammar.java @@ -20,27 +20,22 @@ package org.sonar.objectivec.api; import com.sonar.sslr.api.Grammar; -import com.sonar.sslr.api.Rule; +import org.sonar.sslr.grammar.GrammarRuleKey; +import org.sonar.sslr.grammar.LexerfulGrammarBuilder; -public class ObjectiveCGrammar extends Grammar { +import static com.sonar.sslr.api.GenericTokenType.EOF; - public Rule identifierName; +public enum ObjectiveCGrammar implements GrammarRuleKey { - // A.1 Lexical + COMPILATION_UNIT; - public Rule literal; - public Rule nullLiteral; - public Rule booleanLiteral; - public Rule stringLiteral; + public static Grammar create() { + LexerfulGrammarBuilder b = LexerfulGrammarBuilder.create(); - public Rule program; + b.rule(COMPILATION_UNIT).is(b.zeroOrMore(b.nextNot(EOF), b.anyToken()), EOF); + b.setRootRule(COMPILATION_UNIT); - public Rule sourceElements; - public Rule sourceElement; - - @Override - public Rule getRootRule() { - return program; + return b.buildWithMemoizationOfMatchesForAllRules(); } } diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java index a06b5e79..34ab334b 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java @@ -154,14 +154,17 @@ public enum ObjectiveCKeyword implements TokenType { this.value = value; } + @Override public String getName() { return name(); } + @Override public String getValue() { return value; } + @Override public boolean hasToBeSkippedFromAst(AstNode node) { return false; } diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java index 10e0e975..c8edcd1b 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java @@ -30,22 +30,27 @@ public enum ObjectiveCMetric implements MetricDef { COMPLEXITY, FUNCTIONS; + @Override public String getName() { return name(); } + @Override public boolean isCalculatedMetric() { return false; } + @Override public boolean aggregateIfThereIsAlreadyAValue() { return true; } + @Override public boolean isThereAggregationFormula() { return true; } + @Override public CalculatedMetricFormula getCalculatedMetricFormula() { return null; } diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java index 727fe575..556d4347 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java @@ -93,18 +93,21 @@ public enum ObjectiveCPunctuator implements TokenType { private final String value; - private ObjectiveCPunctuator(String word) { + /*private*/ ObjectiveCPunctuator(String word) { this.value = word; } + @Override public String getName() { return name(); } + @Override public String getValue() { return value; } + @Override public boolean hasToBeSkippedFromAst(AstNode node) { return false; } diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java index 80a9c6f7..8c9fc621 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java @@ -26,14 +26,17 @@ public enum ObjectiveCTokenType implements TokenType { NUMERIC_LITERAL; + @Override public String getName() { return name(); } + @Override public String getValue() { return name(); } + @Override public boolean hasToBeSkippedFromAst(AstNode node) { return false; } diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/checks/CheckList.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/checks/CheckList.java index 293d5f34..bc1a9cce 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/checks/CheckList.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/checks/CheckList.java @@ -27,13 +27,13 @@ public final class CheckList { public static final String REPOSITORY_KEY = "objectivec"; - public static final String SONAR_WAY_PROFILE = "Sonar way"; + public static final String SONAR_WAY_PROFILE = "SonarQube way"; private CheckList() { } public static List getChecks() { - return ImmutableList.of( + return ImmutableList.of( // Add checks here ); } diff --git a/sonar-objective-c-plugin/src/test/java/org/sonar/plugins/objectivec/oclint/ProjectBuilder.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/SonarComponents.java similarity index 50% rename from sonar-objective-c-plugin/src/test/java/org/sonar/plugins/objectivec/oclint/ProjectBuilder.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/SonarComponents.java index dc67ed09..fdaa0319 100644 --- a/sonar-objective-c-plugin/src/test/java/org/sonar/plugins/objectivec/oclint/ProjectBuilder.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/SonarComponents.java @@ -17,34 +17,33 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.plugins.objectivec.oclint; +package org.sonar.objectivec.highlighter; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; +import org.sonar.api.BatchExtension; +import org.sonar.api.batch.fs.FileSystem; +import org.sonar.api.batch.fs.InputFile; +import org.sonar.api.component.ResourcePerspectives; +import org.sonar.api.source.Highlightable; +import javax.annotation.CheckForNull; import java.io.File; -import java.util.ArrayList; -import java.util.List; -import org.sonar.api.resources.Project; -import org.sonar.api.resources.ProjectFileSystem; +public class SonarComponents implements BatchExtension { -final class ProjectBuilder { - private final Project project = new Project("Test"); - private final ProjectFileSystem fileSystem = mock(ProjectFileSystem.class); - private final List sourceDirs = new ArrayList(); + private final ResourcePerspectives resourcePerspectives; + private final FileSystem fs; - public ProjectBuilder() { - project.setFileSystem(fileSystem); - when(fileSystem.getSourceDirs()).thenReturn(sourceDirs); - when(fileSystem.getBasedir()).thenReturn(new File(".")); - } + public SonarComponents(ResourcePerspectives resourcePerspectives, FileSystem fs) { + this.resourcePerspectives = resourcePerspectives; + this.fs = fs; + } - public Project project() { - return project; - } + @CheckForNull + public InputFile inputFileFor(File file) { + return fs.inputFile(fs.predicates().hasAbsolutePath(file.getAbsolutePath())); + } - public void containingSourceDirectory(final String d) { - sourceDirs.add(new File(d)); - } + public Highlightable highlightableFor(InputFile inputFile) { + return resourcePerspectives.as(Highlightable.class, inputFile); + } } diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/SourceFileOffsets.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/SourceFileOffsets.java new file mode 100644 index 00000000..a8ddfdf3 --- /dev/null +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/SourceFileOffsets.java @@ -0,0 +1,91 @@ +/* + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.objectivec.highlighter; + +import com.google.common.collect.Lists; +import com.google.common.io.Files; +import com.sonar.sslr.api.AstNode; +import com.sonar.sslr.api.Token; + +import java.io.File; +import java.io.IOException; +import java.nio.charset.Charset; +import java.util.List; + +public class SourceFileOffsets { + private final int length; + private final List lineStartOffsets = Lists.newArrayList(); + + public SourceFileOffsets(String content) { + this.length = content.length(); + initOffsets(content); + } + + public SourceFileOffsets(File file, Charset charset) { + this(fileContent(file, charset)); + } + + private static String fileContent(File file, Charset charset) { + String fileContent; + try { + fileContent = Files.toString(file, charset); + } catch (IOException e) { + throw new IllegalStateException("Could not read " + file, e); + } + return fileContent; + } + + private void initOffsets(String toParse) { + boolean hasByteOrderMark = toParse.startsWith(Character.toString('\uFEFF')); + lineStartOffsets.add(0); + int i = 0; + while (i < length) { + if (toParse.charAt(i) == '\n' || toParse.charAt(i) == '\r') { + int nextLineStartOffset = i + 1; + if (i < (length - 1) && toParse.charAt(i) == '\r' && toParse.charAt(i + 1) == '\n') { + nextLineStartOffset = i + 2; + i++; + } + lineStartOffsets.add(nextLineStartOffset - (hasByteOrderMark ? 1 : 0)); + } + i++; + } + } + + public int startOffset(Token token) { + int lineStartOffset = lineStartOffsets.get(token.getLine() - 1); + int column = token.getColumn(); + return lineStartOffset + column; + } + + public int endOffset(Token token) { + return startOffset(token) + token.getValue().length(); + } + + public int startOffset(AstNode astNode) { + int lineStartOffset = lineStartOffsets.get(astNode.getTokenLine() - 1); + int column = astNode.getToken().getColumn(); + return lineStartOffset + column; + } + + public int endOffset(AstNode astNode) { + return startOffset(astNode) + astNode.getToIndex() - astNode.getFromIndex(); + } +} diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/SyntaxHighlighterVisitor.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/SyntaxHighlighterVisitor.java new file mode 100644 index 00000000..3c84e535 --- /dev/null +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/SyntaxHighlighterVisitor.java @@ -0,0 +1,142 @@ +/* + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.objectivec.highlighter; + +import com.google.common.base.Preconditions; +import com.google.common.base.Throwables; +import com.google.common.collect.ImmutableMap; +import com.google.common.collect.Lists; +import com.google.common.io.Files; +import com.sonar.sslr.api.AstAndTokenVisitor; +import com.sonar.sslr.api.AstNode; +import com.sonar.sslr.api.AstNodeType; +import com.sonar.sslr.api.Grammar; +import com.sonar.sslr.api.Token; +import com.sonar.sslr.api.Trivia; +import org.sonar.api.batch.fs.InputFile; +import org.sonar.api.source.Highlightable; +import org.sonar.objectivec.api.ObjectiveCKeyword; +import org.sonar.squidbridge.SquidAstVisitor; + +import java.io.IOException; +import java.nio.charset.Charset; +import java.util.List; +import java.util.Map; + +public class SyntaxHighlighterVisitor extends SquidAstVisitor implements AstAndTokenVisitor { + private static final Map TYPES; + + static { + ImmutableMap.Builder typesBuilder = ImmutableMap.builder(); + // Add grammar types to highlight here + TYPES = typesBuilder.build(); + } + + private final SonarComponents sonarComponents; + private final Charset charset; + + private Highlightable.HighlightingBuilder highlighting; + private List lineStart; + + public SyntaxHighlighterVisitor(SonarComponents sonarComponents, Charset charset) { + this.sonarComponents = Preconditions.checkNotNull(sonarComponents); + this.charset = charset; + } + + @Override + public void init() { + for (AstNodeType type : TYPES.keySet()) { + subscribeTo(type); + } + } + + @Override + public void visitFile(AstNode astNode) { + if (astNode == null) { + // parse error + return; + } + + InputFile inputFile = sonarComponents.inputFileFor(getContext().getFile()); + Preconditions.checkNotNull(inputFile); + highlighting = sonarComponents.highlightableFor(inputFile).newHighlighting(); + + lineStart = Lists.newArrayList(); + final String content; + try { + content = Files.toString(getContext().getFile(), charset); + } catch (IOException e) { + throw Throwables.propagate(e); + } + lineStart.add(0); + for (int i = 0; i < content.length(); i++) { + if (content.charAt(i) == '\n' || (content.charAt(i) == '\r' && i + 1 < content.length() && content.charAt(i + 1) != '\n')) { + lineStart.add(i + 1); + } + } + } + + @Override + public void visitNode(AstNode astNode) { + highlighting.highlight(astNode.getFromIndex(), astNode.getToIndex(), TYPES.get(astNode.getType())); + } + + @Override + public void visitToken(Token token) { + for (Trivia trivia : token.getTrivia()) { + if (trivia.isComment()) { + Token triviaToken = trivia.getToken(); + if (triviaToken.getValue().startsWith("/**")) { + highlightToken(triviaToken, "jd"); + } else if (triviaToken.getValue().startsWith("/*")) { + highlightToken(triviaToken, "cppd"); + } else { + highlightToken(triviaToken, "cd"); + } + } + } + + if (token.getType() instanceof ObjectiveCKeyword) { + highlightToken(token, "k"); + } + } + + private void highlightToken(Token token, String typeOfText) { + int offset = getOffset(token.getLine(), token.getColumn()); + highlighting.highlight(offset, offset + token.getValue().length(), typeOfText); + } + + /** + * @param line starts from 1 + * @param column starts from 0 + */ + private int getOffset(int line, int column) { + return lineStart.get(line - 1) + column; + } + + @Override + public void leaveFile(AstNode astNode) { + if (astNode == null) { + // parse error + return; + } + highlighting.done(); + } +} diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/parser/ObjectiveCGrammarImpl.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/package-info.java similarity index 67% rename from sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/parser/ObjectiveCGrammarImpl.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/package-info.java index 91d1eac8..1054849a 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/parser/ObjectiveCGrammarImpl.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/package-info.java @@ -17,18 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.objectivec.parser; +@ParametersAreNonnullByDefault +package org.sonar.objectivec.highlighter; -import org.sonar.objectivec.api.ObjectiveCGrammar; - -import static com.sonar.sslr.api.GenericTokenType.EOF; -import static com.sonar.sslr.api.GenericTokenType.LITERAL; -import static com.sonar.sslr.impl.matcher.GrammarFunctions.Standard.o2n; - -public class ObjectiveCGrammarImpl extends ObjectiveCGrammar { - - public ObjectiveCGrammarImpl() { - program.is(o2n(LITERAL), EOF); - } - -} +import javax.annotation.ParametersAreNonnullByDefault; \ No newline at end of file diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java index b1f7c117..424ae729 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java @@ -21,7 +21,11 @@ import com.sonar.sslr.impl.Lexer; import com.sonar.sslr.impl.channel.BlackHoleChannel; +import com.sonar.sslr.impl.channel.IdentifierAndKeywordChannel; +import com.sonar.sslr.impl.channel.PunctuatorChannel; import org.sonar.objectivec.ObjectiveCConfiguration; +import org.sonar.objectivec.api.ObjectiveCKeyword; +import org.sonar.objectivec.api.ObjectiveCPunctuator; import static com.sonar.sslr.api.GenericTokenType.LITERAL; import static com.sonar.sslr.impl.channel.RegexpChannelBuilder.commentRegexp; @@ -30,6 +34,7 @@ public class ObjectiveCLexer { private ObjectiveCLexer() { + // prevents outside instantiation } public static Lexer create() { @@ -42,11 +47,15 @@ public static Lexer create(ObjectiveCConfiguration conf) { .withFailIfNoChannelToConsumeOneCharacter(false) - // Comments + /* Comments */ .withChannel(commentRegexp("//[^\\n\\r]*+")) .withChannel(commentRegexp("/\\*[\\s\\S]*?\\*/")) - // All other tokens + /* Identifiers, keywords, and punctuators */ + .withChannel(new IdentifierAndKeywordChannel("(#|@)?[a-zA-Z]([a-zA-Z0-9_]*[a-zA-Z0-9])?+((\\s+)?\\*)?", true, ObjectiveCKeyword.values())) + .withChannel(new PunctuatorChannel(ObjectiveCPunctuator.values())) + + /* All other tokens */ .withChannel(regexp(LITERAL, "[^\r\n\\s/]+")) .withChannel(new BlackHoleChannel("[\\s]")) diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java index 985b6517..3a4a14b2 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java @@ -19,6 +19,7 @@ */ package org.sonar.objectivec.parser; +import com.sonar.sslr.api.Grammar; import com.sonar.sslr.impl.Parser; import org.sonar.objectivec.ObjectiveCConfiguration; import org.sonar.objectivec.api.ObjectiveCGrammar; @@ -30,12 +31,12 @@ private ObjectiveCParser() { // Prevent outside instantiation } - public static Parser create() { + public static Parser create() { return create(new ObjectiveCConfiguration()); } - public static Parser create(ObjectiveCConfiguration conf) { - return Parser.builder((ObjectiveCGrammar) new ObjectiveCGrammarImpl()) + public static Parser create(ObjectiveCConfiguration conf) { + return Parser.builder(ObjectiveCGrammar.create()) .withLexer(ObjectiveCLexer.create(conf)) .build(); } diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java index 45d64fbf..ba2ac7f7 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java @@ -60,6 +60,7 @@ public ObjectiveC(Settings settings) { this.settings = settings; } + @Override public String[] getFileSuffixes() { String[] suffixes = filterEmptyStrings(settings.getStringArray(ObjectiveC.FILE_SUFFIXES_KEY)); if (suffixes.length == 0) { diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCColorizerFormat.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCColorizerFormat.java deleted file mode 100644 index 758997d3..00000000 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCColorizerFormat.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * SonarQube Objective-C (Community) Plugin - * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors - * mailto:sonarqube@googlegroups.com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.plugins.objectivec; - -import com.google.common.collect.ImmutableList; -import org.sonar.api.web.CodeColorizerFormat; -import org.sonar.colorizer.CDocTokenizer; -import org.sonar.colorizer.CppDocTokenizer; -import org.sonar.colorizer.JavadocTokenizer; -import org.sonar.colorizer.KeywordsTokenizer; -import org.sonar.colorizer.StringTokenizer; -import org.sonar.colorizer.Tokenizer; -import org.sonar.objectivec.api.ObjectiveCKeyword; - -import java.util.List; - -public class ObjectiveCColorizerFormat extends CodeColorizerFormat { - - public ObjectiveCColorizerFormat() { - super(ObjectiveC.KEY); - } - - @Override - public List getTokenizers() { - return ImmutableList.of( - new StringTokenizer("", ""), - new CDocTokenizer("", ""), - new JavadocTokenizer("", ""), - new CppDocTokenizer("", ""), - new KeywordsTokenizer("", "", ObjectiveCKeyword.keywordValues())); - } - -} diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCCpdMapping.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCCpdMapping.java index 7519991d..c8386e0c 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCCpdMapping.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCCpdMapping.java @@ -35,10 +35,12 @@ public ObjectiveCCpdMapping(ObjectiveC language, FileSystem fileSystem) { this.charset = fileSystem.encoding(); } + @Override public Tokenizer getTokenizer() { return new ObjectiveCTokenizer(charset); } + @Override public Language getLanguage() { return language; } diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java index 5713bd0a..816f58c2 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java @@ -38,8 +38,9 @@ import java.util.List; public class ObjectiveCPlugin extends SonarPlugin { + @Override public List getExtensions() { - List extensions = new ArrayList(); + List extensions = new ArrayList<>(); extensions.add(ObjectiveC.class); extensions.add(PropertyDefinition.builder(ObjectiveC.FILE_SUFFIXES_KEY) @@ -49,7 +50,6 @@ public List getExtensions() { .onQualifiers(Qualifiers.PROJECT) .build()); - extensions.add(ObjectiveCColorizerFormat.class); extensions.add(ObjectiveCCpdMapping.class); extensions.add(ObjectiveCSquidSensor.class); diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java index 2020c370..8ea2bcd0 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java @@ -21,6 +21,7 @@ import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; +import com.sonar.sslr.api.Grammar; import org.sonar.api.batch.Sensor; import org.sonar.api.batch.SensorContext; import org.sonar.api.batch.fs.FilePredicate; @@ -38,9 +39,9 @@ import org.sonar.api.scan.filesystem.PathResolver; import org.sonar.objectivec.ObjectiveCAstScanner; import org.sonar.objectivec.ObjectiveCConfiguration; -import org.sonar.objectivec.api.ObjectiveCGrammar; import org.sonar.objectivec.api.ObjectiveCMetric; import org.sonar.objectivec.checks.CheckList; +import org.sonar.objectivec.highlighter.SonarComponents; import org.sonar.squidbridge.AstScanner; import org.sonar.squidbridge.SquidAstVisitor; import org.sonar.squidbridge.api.CheckMessage; @@ -49,16 +50,17 @@ import org.sonar.squidbridge.checks.SquidCheck; import org.sonar.squidbridge.indexer.QueryByType; +import javax.annotation.Nullable; +import java.io.File; import java.util.Collection; import java.util.List; import java.util.Locale; public class ObjectiveCSquidSensor implements Sensor { - private Project project; private SensorContext context; - private final Checks> checks; + private final Checks> checks; private final FileSystem fileSystem; private final FilePredicate mainFilePredicates; private final PathResolver pathResolver; @@ -67,7 +69,7 @@ public class ObjectiveCSquidSensor implements Sensor { public ObjectiveCSquidSensor(CheckFactory checkFactory, FileSystem fileSystem, ResourcePerspectives resourcePerspectives, PathResolver pathResolver) { this.checks = checkFactory - .>create(CheckList.REPOSITORY_KEY) + .>create(CheckList.REPOSITORY_KEY) .addAnnotatedChecks(CheckList.getChecks()); this.fileSystem = fileSystem; this.mainFilePredicates = fileSystem.predicates().and( @@ -77,18 +79,20 @@ public ObjectiveCSquidSensor(CheckFactory checkFactory, FileSystem fileSystem, this.resourcePerspectives = resourcePerspectives; } + @Override public boolean shouldExecuteOnProject(Project project) { return project.isRoot() && fileSystem.hasFiles(fileSystem.predicates().hasLanguage(ObjectiveC.KEY)); } + @Override public void analyse(Project project, SensorContext context) { - this.project = project; this.context = context; - List> visitors = Lists.>newArrayList(checks.all()); + List> visitors = Lists.>newArrayList(checks.all()); - @SuppressWarnings("unchecked") AstScanner scanner = - ObjectiveCAstScanner.create(createConfiguration(), visitors.toArray(new SquidAstVisitor[visitors.size()])); + @SuppressWarnings("unchecked") AstScanner scanner = ObjectiveCAstScanner.create( + createConfiguration(), new SonarComponents(resourcePerspectives, fileSystem), + visitors.toArray(new SquidAstVisitor[visitors.size()])); scanner.scanFiles(ImmutableList.copyOf(fileSystem.files(mainFilePredicates))); @@ -104,7 +108,7 @@ private void save(Collection squidSourceFiles) { for (SourceCode squidSourceFile : squidSourceFiles) { SourceFile squidFile = (SourceFile) squidSourceFile; - String relativePath = pathResolver.relativePath(fileSystem.baseDir(), new java.io.File(squidFile.getKey())); + String relativePath = pathResolver.relativePath(fileSystem.baseDir(), new File(squidFile.getKey())); InputFile inputFile = fileSystem.inputFile(fileSystem.predicates().hasRelativePath(relativePath)); /* @@ -138,16 +142,15 @@ private void saveMeasures(InputFile inputFile, SourceFile squidFile) { //context.saveMeasure(inputFile, CoreMetrics.COMPLEXITY, squidFile.getDouble(ObjectiveCMetric.COMPLEXITY)); } - private void saveViolations(InputFile inputFile, SourceFile squidFile) { + private void saveViolations(@Nullable InputFile inputFile, SourceFile squidFile) { Collection messages = squidFile.getCheckMessages(); - Resource resource = context.getResource( - org.sonar.api.resources.File.fromIOFile(inputFile.file(), project)); + final Resource resource = inputFile == null ? null : context.getResource(inputFile); if (messages != null && resource != null) { for (CheckMessage message : messages) { @SuppressWarnings("unchecked") RuleKey ruleKey = - checks.ruleKey((SquidCheck) message.getCheck()); + checks.ruleKey((SquidCheck) message.getCheck()); Issuable issuable = resourcePerspectives.as(Issuable.class, resource); diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCTokenizer.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCTokenizer.java index db8a9834..8557d807 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCTokenizer.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCTokenizer.java @@ -41,6 +41,7 @@ public ObjectiveCTokenizer(Charset charset) { this.charset = charset; } + @Override public void tokenize(SourceCode source, Tokens cpdTokens) throws IOException { Lexer lexer = ObjectiveCLexer.create(new ObjectiveCConfiguration(charset)); String fileName = source.getFileName(); diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangPlistParser.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangPlistParser.java index 51b5c999..05dbbd55 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangPlistParser.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangPlistParser.java @@ -41,8 +41,12 @@ public final class ClangPlistParser { private static final Logger LOGGER = LoggerFactory.getLogger(ClangPlistParser.class); + private ClangPlistParser() { + // Prevents outside instantiation + } + public static List parse(final File reportsDir) { - List result = new ArrayList(); + List result = new ArrayList<>(); File[] reports = getReports(reportsDir); @@ -63,6 +67,7 @@ private static File[] getReports(final File reportsDir) { } return reportsDir.listFiles(new FilenameFilter() { + @Override public boolean accept(File dir, String name) { return name.endsWith(".plist"); } @@ -71,7 +76,7 @@ public boolean accept(File dir, String name) { @SuppressWarnings("unchecked") private static List parsePlist(final File file) { - List result = new ArrayList(); + List result = new ArrayList<>(); try { // Clang report is NSDictionary, which converts to a Map @@ -79,14 +84,14 @@ private static List parsePlist(final File file) { (Map) XMLPropertyListParser.parse(file).toJavaObject(); // Files reported on in this report - List files = new ArrayList(); + List files = new ArrayList<>(); for (Object obj : (Object[]) report.get("files")) { files.add((String) obj); } // Diagnostics which contain the warning and the execution path // (we're only interested in the final location) - List> diagnostics = new ArrayList>(); + List> diagnostics = new ArrayList<>(); for (Object obj : (Object[]) report.get("diagnostics")) { diagnostics.add((Map) obj); } @@ -104,15 +109,7 @@ private static List parsePlist(final File file) { result.add(clangWarning); } - } catch (final IOException e) { - LOGGER.error("Error processing file named {}", file, e); - } catch (final ParserConfigurationException e) { - LOGGER.error("Error processing file named {}", file, e); - } catch (final ParseException e) { - LOGGER.error("Error processing file named {}", file, e); - } catch (final SAXException e) { - LOGGER.error("Error processing file named {}", file, e); - } catch (final PropertyListFormatException e) { + } catch (final IOException | ParserConfigurationException | ParseException | SAXException | PropertyListFormatException e) { LOGGER.error("Error processing file named {}", file, e); } diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfile.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfile.java index ebc44e45..4360e4da 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfile.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfile.java @@ -19,7 +19,6 @@ */ package org.sonar.plugins.objectivec.clang; -import com.google.common.io.Closeables; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.profiles.ProfileDefinition; @@ -27,6 +26,7 @@ import org.sonar.api.utils.ValidationMessages; import org.sonar.plugins.objectivec.ObjectiveC; +import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; @@ -42,19 +42,17 @@ public ClangProfile(final ClangProfileImporter importer) { @Override public RulesProfile createProfile(final ValidationMessages messages) { LOGGER.info("Creating Clang Profile"); - Reader profileXmlReader = null; - try { - profileXmlReader = new InputStreamReader(ClangProfile.class.getResourceAsStream( - "/org/sonar/plugins/objectivec/profile-clang.xml")); + try (Reader profileXmlReader = new InputStreamReader(ClangProfile.class.getResourceAsStream( + "/org/sonar/plugins/objectivec/profile-clang.xml"))) { RulesProfile profile = importer.importProfile(profileXmlReader, messages); profile.setLanguage(ObjectiveC.KEY); profile.setName(ClangRulesDefinition.REPOSITORY_NAME); return profile; - } finally { - Closeables.closeQuietly(profileXmlReader); + } catch (IOException e) { + throw new IllegalStateException("Unable to read profile XML", e); } } } diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangSensor.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangSensor.java index fd72ccdc..f97f9322 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangSensor.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangSensor.java @@ -25,11 +25,11 @@ import org.sonar.api.batch.Sensor; import org.sonar.api.batch.SensorContext; import org.sonar.api.batch.fs.FileSystem; +import org.sonar.api.batch.fs.InputFile; import org.sonar.api.component.ResourcePerspectives; import org.sonar.api.config.Settings; import org.sonar.api.issue.Issuable; import org.sonar.api.issue.Issue; -import org.sonar.api.profiles.RulesProfile; import org.sonar.api.resources.Project; import org.sonar.api.resources.Resource; import org.sonar.api.rule.RuleKey; @@ -74,10 +74,10 @@ public void analyse(Project project, SensorContext context) { return; } - collect(project, context, reportsDir); + collect(context, reportsDir); } - protected void collect(Project project, SensorContext context, File reportsDir) { + protected void collect(SensorContext context, File reportsDir) { LOGGER.info("parsing {}", reportsDir); List clangWarnings = ClangPlistParser.parse(reportsDir); @@ -93,8 +93,9 @@ protected void collect(Project project, SensorContext context, File reportsDir) LOGGER.debug("Type '{}' is not mapped to a rule -- using default rule '{}'", type, ruleKeyName); } - Resource resource = context.getResource( - org.sonar.api.resources.File.fromIOFile(clangWarning.getFile(), project)); + final InputFile inputFile = + fileSystem.inputFile(fileSystem.predicates().hasPath(clangWarning.getFile().getPath())); + final Resource resource = inputFile == null ? null : context.getResource(inputFile); if (resource == null) { LOGGER.debug("Skipping file (not found in index): {}", clangWarning.getFile().getPath()); diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaReportParser.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaReportParser.java index 2ad2df70..48dee6a2 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaReportParser.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaReportParser.java @@ -25,9 +25,9 @@ import org.codehaus.staxmate.in.SMInputCursor; import org.sonar.api.batch.SensorContext; import org.sonar.api.batch.fs.FileSystem; +import org.sonar.api.batch.fs.InputFile; import org.sonar.api.measures.CoverageMeasuresBuilder; import org.sonar.api.measures.Measure; -import org.sonar.api.resources.Project; import org.sonar.api.resources.Resource; import org.sonar.api.utils.ParsingUtils; import org.sonar.api.utils.StaxParser; @@ -41,26 +41,23 @@ final class CoberturaReportParser { private final FileSystem fileSystem; - private final Project project; private final SensorContext context; - private CoberturaReportParser(FileSystem fileSystem, Project project, SensorContext context) { + private CoberturaReportParser(FileSystem fileSystem, SensorContext context) { this.fileSystem = fileSystem; - this.project = project; this.context = context; } /** * Parse a Cobertura xml report and create measures accordingly */ - public static void parseReport(File xmlFile, FileSystem fileSystem, Project project, SensorContext context) { - new CoberturaReportParser(fileSystem, project, context).parse(xmlFile); + public static void parseReport(File xmlFile, FileSystem fileSystem, SensorContext context) { + new CoberturaReportParser(fileSystem, context).parse(xmlFile); } private void parse(File xmlFile) { try { StaxParser parser = new StaxParser(new StaxParser.XmlStreamHandler() { - @Override public void stream(SMHierarchicCursor rootCursor) throws XMLStreamException { rootCursor.advance(); @@ -77,10 +74,13 @@ private void collectPackageMeasures(SMInputCursor pack) throws XMLStreamExceptio while (pack.getNext() != null) { Map builderByFilename = Maps.newHashMap(); collectFileMeasures(pack.descendantElementCursor("class"), builderByFilename); + for (Map.Entry entry : builderByFilename.entrySet()) { String filePath = entry.getKey(); - Resource resource = org.sonar.api.resources.File.fromIOFile(new File(fileSystem.baseDir(), filePath), project); - if (resourceExists(resource)) { + final InputFile inputFile = fileSystem.inputFile(fileSystem.predicates().hasPath(filePath)); + final Resource resource = inputFile == null ? null : context.getResource(inputFile); + + if (resource != null) { for (Measure measure : entry.getValue().createMeasures()) { context.saveMeasure(resource, measure); } @@ -89,19 +89,17 @@ private void collectPackageMeasures(SMInputCursor pack) throws XMLStreamExceptio } } - private boolean resourceExists(Resource file) { - return context.getResource(file) != null; - } - private static void collectFileMeasures(SMInputCursor clazz, Map builderByFilename) throws XMLStreamException { while (clazz.getNext() != null) { String fileName = clazz.getAttrValue("filename"); CoverageMeasuresBuilder builder = builderByFilename.get(fileName); + if (builder == null) { builder = CoverageMeasuresBuilder.create(); builderByFilename.put(fileName, builder); } + collectFileData(clazz, builder); } } diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaSensor.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaSensor.java index 591d0a18..33de51a7 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaSensor.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/cobertura/CoberturaSensor.java @@ -64,7 +64,7 @@ public void analyse(Project project, SensorContext context) { } LOGGER.info("parsing {}", report); - CoberturaReportParser.parseReport(report, fileSystem, project, context); + CoberturaReportParser.parseReport(report, fileSystem, context); } @Override diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardReportParser.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardReportParser.java index 1dfb233b..243f2296 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardReportParser.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardReportParser.java @@ -86,12 +86,8 @@ public static Map> parseReport(final File xmlFile) { result = new LizardReportParser().parseFile(document); } catch (final FileNotFoundException e) { LOGGER.error("Lizard Report not found {}", xmlFile, e); - } catch (final IOException e) { - LOGGER.error("Error processing file named {}", xmlFile, e); - } catch (final ParserConfigurationException e) { + } catch (final IOException | ParserConfigurationException | SAXException e) { LOGGER.error("Error parsing file named {}", xmlFile, e); - } catch (final SAXException e) { - LOGGER.error("Error processing file named {}", xmlFile, e); } return result; @@ -102,8 +98,8 @@ public static Map> parseReport(final File xmlFile) { * @return Map containing as key the name of the file and as value a list containing the measures for that file */ private Map> parseFile(Document document) { - final Map> reportMeasures = new HashMap>(); - final List functions = new ArrayList(); + final Map> reportMeasures = new HashMap<>(); + final List functions = new ArrayList<>(); NodeList nodeList = document.getElementsByTagName(MEASURE); @@ -157,7 +153,7 @@ private void addComplexityFileMeasures(NodeList itemList, Map buildMeasureList(int complexity, double fileComplexity, int numberOfFunctions) { - List list = new ArrayList(); + List list = new ArrayList<>(); list.add(new Measure(CoreMetrics.COMPLEXITY).setIntValue(complexity)); list.add(new Measure(CoreMetrics.FUNCTIONS).setIntValue(numberOfFunctions)); list.add(new Measure(CoreMetrics.FILE_COMPLEXITY, fileComplexity)); @@ -227,7 +223,7 @@ private void addComplexityFunctionMeasures(Map> reportMeas */ public List buildFuncionMeasuresList(double complexMean, int complexityInFunctions, RangeDistributionBuilder builder) { - List list = new ArrayList(); + List list = new ArrayList<>(); list.add(new Measure(CoreMetrics.FUNCTION_COMPLEXITY, complexMean)); list.add(new Measure(CoreMetrics.COMPLEXITY_IN_FUNCTIONS).setIntValue(complexityInFunctions)); list.add(builder.build().setPersistenceMode(PersistenceMode.MEMORY)); diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java index 5c53f055..7f9c28b3 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java @@ -25,9 +25,11 @@ import org.sonar.api.batch.Sensor; import org.sonar.api.batch.SensorContext; import org.sonar.api.batch.fs.FileSystem; +import org.sonar.api.batch.fs.InputFile; import org.sonar.api.config.Settings; import org.sonar.api.measures.Measure; import org.sonar.api.resources.Project; +import org.sonar.api.resources.Resource; import org.sonar.api.scan.filesystem.PathResolver; import org.sonar.plugins.objectivec.ObjectiveC; @@ -81,22 +83,18 @@ public void analyse(Project project, SensorContext context) { } LOGGER.info("Saving results of complexity analysis"); - saveMeasures(project, context, measures); + saveMeasures(context, measures); } - private void saveMeasures(Project project, SensorContext context, final Map> measures) { + private void saveMeasures(SensorContext context, final Map> measures) { for (Map.Entry> entry : measures.entrySet()) { - final org.sonar.api.resources.File file = - org.sonar.api.resources.File.fromIOFile(new File(entry.getKey()), project); + final InputFile inputFile = fileSystem.inputFile(fileSystem.predicates().hasPath(entry.getKey())); + final Resource resource = inputFile == null ? null : context.getResource(inputFile); - if (context.getResource(file) != null) { + if (resource != null) { for (Measure measure : entry.getValue()) { - try { - LOGGER.debug("Save measure {} for file {}", measure.getMetric().getName(), file); - context.saveMeasure(file, measure); - } catch (Exception e) { - LOGGER.error(" Exception -> {} -> {}", entry.getKey(), measure.getMetric().getName()); - } + LOGGER.debug("Save measure {} for file {}", measure.getMetric().getName(), resource.getPath()); + context.saveMeasure(resource, measure); } } } diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintParser.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintParser.java index 49bb2f86..b2e4c4e0 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintParser.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintParser.java @@ -24,10 +24,12 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.batch.SensorContext; +import org.sonar.api.batch.fs.FileSystem; +import org.sonar.api.batch.fs.InputFile; import org.sonar.api.component.ResourcePerspectives; import org.sonar.api.issue.Issuable; import org.sonar.api.issue.Issue; -import org.sonar.api.resources.Project; +import org.sonar.api.resources.Resource; import org.sonar.api.rule.RuleKey; import org.sonar.api.utils.StaxParser; import org.sonar.api.utils.XmlParserException; @@ -38,20 +40,20 @@ final class OCLintParser { private static final Logger LOGGER = LoggerFactory.getLogger(OCLintParser.class); - private final Project project; + private final FileSystem fileSystem; private final SensorContext context; private final ResourcePerspectives resourcePerspectives; - private OCLintParser(final Project project, final SensorContext context, + private OCLintParser(final FileSystem fileSystem, final SensorContext context, final ResourcePerspectives resourcePerspectives) { - this.project = project; + this.fileSystem = fileSystem; this.context = context; this.resourcePerspectives = resourcePerspectives; } - public static void parseReport(File xmlFile, Project project, SensorContext context, + public static void parseReport(File xmlFile, FileSystem fileSystem, SensorContext context, ResourcePerspectives resourcePerspectives) { - new OCLintParser(project, context, resourcePerspectives).parse(xmlFile); + new OCLintParser(fileSystem, context, resourcePerspectives).parse(xmlFile); } @@ -75,17 +77,17 @@ private void collectFiles(final SMInputCursor file) throws XMLStreamException { final String filePath = file.getAttrValue("name"); LOGGER.debug("Collecting issues for {}", filePath); - final org.sonar.api.resources.File resource = org.sonar.api.resources.File.fromIOFile(new File(filePath), project); + final InputFile inputFile = fileSystem.inputFile(fileSystem.predicates().hasPath(filePath)); + final Resource resource = inputFile == null ? null : context.getResource(inputFile); - if (context.getResource(resource) != null) { + if (resource != null) { LOGGER.debug("File {} was found in the project.", filePath); collectFileIssues(resource, file); } } } - private void collectFileIssues(final org.sonar.api.resources.File resource, - final SMInputCursor file) throws XMLStreamException { + private void collectFileIssues(final Resource resource, final SMInputCursor file) throws XMLStreamException { final SMInputCursor line = file.childElementCursor("violation"); while (line.getNext() != null) { @@ -93,8 +95,7 @@ private void collectFileIssues(final org.sonar.api.resources.File resource, } } - private void recordIssue(final org.sonar.api.resources.File resource, - final SMInputCursor line) throws XMLStreamException { + private void recordIssue(final Resource resource, final SMInputCursor line) throws XMLStreamException { Issuable issuable = resourcePerspectives.as(Issuable.class, resource); if (issuable != null) { diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java index e522f5fe..d498952e 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java @@ -19,7 +19,6 @@ */ package org.sonar.plugins.objectivec.oclint; -import com.google.common.io.Closeables; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.sonar.api.profiles.ProfileDefinition; @@ -27,6 +26,7 @@ import org.sonar.api.utils.ValidationMessages; import org.sonar.plugins.objectivec.ObjectiveC; +import java.io.IOException; import java.io.InputStreamReader; import java.io.Reader; @@ -42,11 +42,9 @@ public OCLintProfile(final OCLintProfileImporter importer) { @Override public RulesProfile createProfile(final ValidationMessages messages) { LOGGER.info("Creating OCLint Profile"); - Reader profileXmlReader = null; - try { - profileXmlReader = new InputStreamReader(OCLintProfile.class.getResourceAsStream( - "/org/sonar/plugins/objectivec/profile-oclint.xml")); + try (Reader profileXmlReader = new InputStreamReader(OCLintProfile.class.getResourceAsStream( + "/org/sonar/plugins/objectivec/profile-oclint.xml"))) { RulesProfile profile = importer.importProfile(profileXmlReader, messages); profile.setLanguage(ObjectiveC.KEY); @@ -54,8 +52,8 @@ public RulesProfile createProfile(final ValidationMessages messages) { profile.setDefaultProfile(true); return profile; - } finally { - Closeables.closeQuietly(profileXmlReader); + } catch (IOException e) { + throw new IllegalStateException("Unable to read profile XML", e); } } } diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintSensor.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintSensor.java index 161f6a23..ec807ff3 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintSensor.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintSensor.java @@ -50,10 +50,12 @@ public OCLintSensor(final FileSystem fileSystem, final PathResolver pathResolver this.settings = settings; } + @Override public boolean shouldExecuteOnProject(final Project project) { return StringUtils.isNotEmpty(settings.getString(REPORT_PATH_KEY)); } + @Override public void analyse(final Project project, final SensorContext context) { String path = settings.getString(REPORT_PATH_KEY); File report = pathResolver.relativeFile(fileSystem.baseDir(), path); @@ -64,7 +66,7 @@ public void analyse(final Project project, final SensorContext context) { } LOGGER.info("parsing {}", report); - OCLintParser.parseReport(report, project, context, resourcePerspectives); + OCLintParser.parseReport(report, fileSystem, context, resourcePerspectives); } @Override diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java index fbfb6f3d..460c026c 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireParser.java @@ -29,15 +29,11 @@ import org.sonar.api.component.ResourcePerspectives; import org.sonar.api.measures.CoreMetrics; import org.sonar.api.measures.Metric; -import org.sonar.api.resources.Project; -import org.sonar.api.resources.Qualifiers; import org.sonar.api.resources.Resource; import org.sonar.api.test.MutableTestPlan; import org.sonar.api.test.TestCase; import org.sonar.api.utils.ParsingUtils; -import org.sonar.api.utils.SonarException; import org.sonar.api.utils.StaxParser; -import org.sonar.plugins.objectivec.ObjectiveC; import org.sonar.plugins.objectivec.surefire.data.SurefireStaxHandler; import org.sonar.plugins.objectivec.surefire.data.UnitTestClassReport; import org.sonar.plugins.objectivec.surefire.data.UnitTestIndex; @@ -53,14 +49,12 @@ public final class SurefireParser { private static final Logger LOGGER = LoggerFactory.getLogger(SurefireParser.class); private final FileSystem fileSystem; - private final Project project; private final SensorContext context; private final ResourcePerspectives perspectives; - public SurefireParser(FileSystem fileSystem, Project project, ResourcePerspectives perspectives, + public SurefireParser(FileSystem fileSystem, ResourcePerspectives perspectives, SensorContext context) { this.fileSystem = fileSystem; - this.project = project; this.perspectives = perspectives; this.context = context; } @@ -81,6 +75,7 @@ private File[] getReports(File dir) { } return dir.listFiles(new FilenameFilter() { + @Override public boolean accept(File dir, String name) { return name.startsWith("TEST") && name.endsWith(".xml"); } @@ -105,7 +100,7 @@ private static void parseFiles(File[] reports, UnitTestIndex index) { try { parser.parse(report); } catch (XMLStreamException e) { - throw new SonarException("Fail to parse the Surefire report: " + report, e); + throw new IllegalStateException("Fail to parse the Surefire report: " + report, e); } } } @@ -171,17 +166,14 @@ protected void saveResults(Resource testFile, UnitTestClassReport report) { public Resource getUnitTestResource(String classname) { String fileName = classname.replace('.', '/') + ".m"; - File file = new File(fileName); - if (!file.isAbsolute()) { - file = new File(fileSystem.baseDir(), fileName); - } + InputFile inputFile = fileSystem.inputFile(fileSystem.predicates().hasPath(fileName)); /* * Most xcodebuild JUnit parsers don't include the path to the class in the class field, so search for it if it * wasn't found in the root. */ - if (!file.isFile() || !file.exists()) { - List files = ImmutableList.copyOf(fileSystem.files(fileSystem.predicates().and( + if (inputFile == null) { + List files = ImmutableList.copyOf(fileSystem.inputFiles(fileSystem.predicates().and( fileSystem.predicates().hasType(InputFile.Type.TEST), fileSystem.predicates().matchesPathPattern("**/" + fileName)))); @@ -192,13 +184,11 @@ public Resource getUnitTestResource(String classname) { * Lazily get the first file, since we wouldn't be able to determine the correct one from just the * test class name in the event that there are multiple matches. */ - file = files.get(0); + inputFile = files.get(0); } } - org.sonar.api.resources.File sonarFile = org.sonar.api.resources.File.fromIOFile(file, project); - sonarFile.setQualifier(Qualifiers.UNIT_TEST_FILE); - return sonarFile; + return inputFile == null ? null : context.getResource(inputFile); } private void saveMeasure(Resource resource, Metric metric, double value) { diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java index 0f7d706c..fb3331d7 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/surefire/SurefireSensor.java @@ -65,12 +65,12 @@ public void analyse(Project project, SensorContext context) { return; } - collect(project, context, reportsDir); + collect(context, reportsDir); } - protected void collect(Project project, SensorContext context, File reportsDir) { + protected void collect(SensorContext context, File reportsDir) { LOGGER.info("parsing {}", reportsDir); - new SurefireParser(fileSystem, project, resourcePerspectives, context).collect(reportsDir); + new SurefireParser(fileSystem, resourcePerspectives, context).collect(reportsDir); } @Override diff --git a/sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java b/sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java index a2f1c4e3..8905db3f 100644 --- a/sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java +++ b/sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java @@ -33,6 +33,7 @@ import com.sonar.sslr.api.GenericTokenType; import com.sonar.sslr.api.Token; import com.sonar.sslr.impl.Lexer; +import org.sonar.objectivec.api.ObjectiveCKeyword; public class ObjectiveCLexerTest { @@ -63,7 +64,7 @@ public void lexEndOflineComment() { @Test public void lexLineOfCode() { - assertThat(lexer.lex("[self init];"), hasToken("[self", GenericTokenType.LITERAL)); + assertThat(lexer.lex("[self init];"), hasToken("self", ObjectiveCKeyword.SELF)); } @Test @@ -76,7 +77,7 @@ public void lexEmptyLine() { @Test public void lexSampleFile() { List tokens = lexer.lex(new File("src/test/resources/objcSample.h")); - assertThat(tokens.size(), equalTo(16)); + assertThat(tokens.size(), equalTo(24)); assertThat(tokens, hasToken(GenericTokenType.EOF)); } From 1f13057fde6e94c5493f4cc4f6a554307bf2e3cc Mon Sep 17 00:00:00 2001 From: Matthew DeTullio Date: Sun, 6 Mar 2016 15:59:04 -0500 Subject: [PATCH 37/42] Lexer improvements for highlighter --- .../objectivec/api/ObjectiveCPunctuator.java | 1 + .../objectivec/api/ObjectiveCTokenType.java | 14 +- .../highlighter/SourceFileOffsets.java | 91 ---------- .../highlighter/SyntaxHighlighterVisitor.java | 14 +- .../objectivec/lexer/BackslashChannel.java | 46 +++++ .../lexer/CharacterLiteralsChannel.java | 114 ++++++++++++ .../objectivec/lexer/ObjectiveCLexer.java | 55 +++++- .../lexer/StringLiteralsChannel.java | 165 ++++++++++++++++++ .../api/ObjectiveCPunctuatorTest.java | 2 +- .../objectivec/lexer/ObjectiveCLexerTest.java | 2 +- 10 files changed, 399 insertions(+), 105 deletions(-) delete mode 100644 sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/SourceFileOffsets.java create mode 100644 sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/BackslashChannel.java create mode 100644 sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/CharacterLiteralsChannel.java create mode 100644 sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/StringLiteralsChannel.java diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java index 556d4347..d0892f37 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java @@ -89,6 +89,7 @@ public enum ObjectiveCPunctuator implements TokenType { MINUSLT("->"), MINUSLTSTAR("->*"), + DOT("."), DOTSTAR(".*"); private final String value; diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java index 8c9fc621..ca0c79ec 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java @@ -19,12 +19,19 @@ */ package org.sonar.objectivec.api; +import com.google.common.collect.ImmutableList; import com.sonar.sslr.api.AstNode; import com.sonar.sslr.api.TokenType; -public enum ObjectiveCTokenType implements TokenType { +import java.util.List; - NUMERIC_LITERAL; +public enum ObjectiveCTokenType implements TokenType { + CHARACTER_LITERAL, + DOUBLE_LITERAL, + FLOAT_LITERAL, + INTEGER_LITERAL, + LONG_LITERAL, + STRING_LITERAL; @Override public String getName() { @@ -41,4 +48,7 @@ public boolean hasToBeSkippedFromAst(AstNode node) { return false; } + public static List numberLiterals() { + return ImmutableList.of(DOUBLE_LITERAL, FLOAT_LITERAL, INTEGER_LITERAL, LONG_LITERAL); + } } diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/SourceFileOffsets.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/SourceFileOffsets.java deleted file mode 100644 index a8ddfdf3..00000000 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/SourceFileOffsets.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * SonarQube Objective-C (Community) Plugin - * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors - * mailto:sonarqube@googlegroups.com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.sonar.objectivec.highlighter; - -import com.google.common.collect.Lists; -import com.google.common.io.Files; -import com.sonar.sslr.api.AstNode; -import com.sonar.sslr.api.Token; - -import java.io.File; -import java.io.IOException; -import java.nio.charset.Charset; -import java.util.List; - -public class SourceFileOffsets { - private final int length; - private final List lineStartOffsets = Lists.newArrayList(); - - public SourceFileOffsets(String content) { - this.length = content.length(); - initOffsets(content); - } - - public SourceFileOffsets(File file, Charset charset) { - this(fileContent(file, charset)); - } - - private static String fileContent(File file, Charset charset) { - String fileContent; - try { - fileContent = Files.toString(file, charset); - } catch (IOException e) { - throw new IllegalStateException("Could not read " + file, e); - } - return fileContent; - } - - private void initOffsets(String toParse) { - boolean hasByteOrderMark = toParse.startsWith(Character.toString('\uFEFF')); - lineStartOffsets.add(0); - int i = 0; - while (i < length) { - if (toParse.charAt(i) == '\n' || toParse.charAt(i) == '\r') { - int nextLineStartOffset = i + 1; - if (i < (length - 1) && toParse.charAt(i) == '\r' && toParse.charAt(i + 1) == '\n') { - nextLineStartOffset = i + 2; - i++; - } - lineStartOffsets.add(nextLineStartOffset - (hasByteOrderMark ? 1 : 0)); - } - i++; - } - } - - public int startOffset(Token token) { - int lineStartOffset = lineStartOffsets.get(token.getLine() - 1); - int column = token.getColumn(); - return lineStartOffset + column; - } - - public int endOffset(Token token) { - return startOffset(token) + token.getValue().length(); - } - - public int startOffset(AstNode astNode) { - int lineStartOffset = lineStartOffsets.get(astNode.getTokenLine() - 1); - int column = astNode.getToken().getColumn(); - return lineStartOffset + column; - } - - public int endOffset(AstNode astNode) { - return startOffset(astNode) + astNode.getToIndex() - astNode.getFromIndex(); - } -} diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/SyntaxHighlighterVisitor.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/SyntaxHighlighterVisitor.java index 3c84e535..16437408 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/SyntaxHighlighterVisitor.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/SyntaxHighlighterVisitor.java @@ -33,6 +33,7 @@ import org.sonar.api.batch.fs.InputFile; import org.sonar.api.source.Highlightable; import org.sonar.objectivec.api.ObjectiveCKeyword; +import org.sonar.objectivec.api.ObjectiveCTokenType; import org.sonar.squidbridge.SquidAstVisitor; import java.io.IOException; @@ -100,11 +101,13 @@ public void visitNode(AstNode astNode) { @Override public void visitToken(Token token) { + // Use org.sonar.api.batch.sensor.highlighting.TypeOfText here? + for (Trivia trivia : token.getTrivia()) { if (trivia.isComment()) { Token triviaToken = trivia.getToken(); if (triviaToken.getValue().startsWith("/**")) { - highlightToken(triviaToken, "jd"); + highlightToken(triviaToken, "j"); } else if (triviaToken.getValue().startsWith("/*")) { highlightToken(triviaToken, "cppd"); } else { @@ -116,6 +119,15 @@ public void visitToken(Token token) { if (token.getType() instanceof ObjectiveCKeyword) { highlightToken(token, "k"); } + + if (ObjectiveCTokenType.numberLiterals().contains(token.getType())) { + highlightToken(token, "c"); + } + + if (ObjectiveCTokenType.STRING_LITERAL.equals(token.getType()) + || ObjectiveCTokenType.CHARACTER_LITERAL.equals(token.getType())) { + highlightToken(token, "s"); + } } private void highlightToken(Token token, String typeOfText) { diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/BackslashChannel.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/BackslashChannel.java new file mode 100644 index 00000000..a05d355b --- /dev/null +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/BackslashChannel.java @@ -0,0 +1,46 @@ +/* + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.objectivec.lexer; + +import com.sonar.sslr.impl.Lexer; +import org.sonar.sslr.channel.Channel; +import org.sonar.sslr.channel.CodeReader; + +/** + * @author Sonar C++ Plugin (Community) authors + */ +public class BackslashChannel extends Channel { + @Override + public boolean consume(CodeReader code, Lexer output) { + char ch = (char) code.peek(); + + if ((ch == '\\') && isNewLine(code.charAt(1))) { + // just throw away the backslash + code.pop(); + return true; + } + + return false; + } + + private static boolean isNewLine(char ch) { + return (ch == '\n') || (ch == '\r'); + } +} diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/CharacterLiteralsChannel.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/CharacterLiteralsChannel.java new file mode 100644 index 00000000..3fd75e11 --- /dev/null +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/CharacterLiteralsChannel.java @@ -0,0 +1,114 @@ +/* + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.objectivec.lexer; + +import com.sonar.sslr.api.Token; +import com.sonar.sslr.impl.Lexer; +import org.sonar.objectivec.api.ObjectiveCTokenType; +import org.sonar.sslr.channel.Channel; +import org.sonar.sslr.channel.CodeReader; + +/** + * @author Sonar C++ Plugin (Community) authors + */ +public class CharacterLiteralsChannel extends Channel { + private static final char EOF = (char) -1; + + private final StringBuilder sb = new StringBuilder(); + + private int index; + private char ch; + + @Override + public boolean consume(CodeReader code, Lexer output) { + int line = code.getLinePosition(); + int column = code.getColumnPosition(); + index = 0; + readPrefix(code); + if ((ch != '\'')) { + return false; + } + if (!read(code)) { + return false; + } + readUdSuffix(code); + for (int i = 0; i < index; i++) { + sb.append((char) code.pop()); + } + output.addToken(Token.builder() + .setLine(line) + .setColumn(column) + .setURI(output.getURI()) + .setValueAndOriginalValue(sb.toString()) + .setType(ObjectiveCTokenType.CHARACTER_LITERAL) + .build()); + sb.setLength(0); + return true; + } + + private boolean read(CodeReader code) { + index++; + while (code.charAt(index) != ch) { + if (code.charAt(index) == EOF) { + return false; + } + if (code.charAt(index) == '\\') { + // escape + index++; + } + index++; + } + index++; + return true; + } + + private void readPrefix(CodeReader code) { + ch = code.charAt(index); + if ((ch == 'u') || (ch == 'U') || ch == 'L') { + index++; + ch = code.charAt(index); + } + } + + private void readUdSuffix(CodeReader code) { + for (int start_index = index, len = 0; ; index++) { + char c = code.charAt(index); + if (c == EOF) { + return; + } + if ((c >= 'a' && c <= 'z') + || (c >= 'A' && c <= 'Z') + || (c == '_')) { + len++; + } else { + if (c >= '0' && c <= '9') { + if (len > 0) { + len++; + } else { + index = start_index; + return; + } + } else { + return; + } + } + } + } +} diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java index 424ae729..040c6493 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java @@ -19,6 +19,7 @@ */ package org.sonar.objectivec.lexer; +import com.sonar.sslr.api.GenericTokenType; import com.sonar.sslr.impl.Lexer; import com.sonar.sslr.impl.channel.BlackHoleChannel; import com.sonar.sslr.impl.channel.IdentifierAndKeywordChannel; @@ -27,11 +28,33 @@ import org.sonar.objectivec.api.ObjectiveCKeyword; import org.sonar.objectivec.api.ObjectiveCPunctuator; -import static com.sonar.sslr.api.GenericTokenType.LITERAL; import static com.sonar.sslr.impl.channel.RegexpChannelBuilder.commentRegexp; import static com.sonar.sslr.impl.channel.RegexpChannelBuilder.regexp; +import static org.sonar.objectivec.api.ObjectiveCTokenType.DOUBLE_LITERAL; +import static org.sonar.objectivec.api.ObjectiveCTokenType.FLOAT_LITERAL; +import static org.sonar.objectivec.api.ObjectiveCTokenType.INTEGER_LITERAL; +import static org.sonar.objectivec.api.ObjectiveCTokenType.LONG_LITERAL; public class ObjectiveCLexer { + private static final String EXP_REGEXP = "(?:[Ee][+-]?+[0-9_]++)"; + private static final String BINARY_EXP_REGEXP = "(?:[Pp][+-]?+[0-9_]++)"; + private static final String FLOATING_LITERAL_WITHOUT_SUFFIX_REGEXP = "(?:" + + // Decimal + "[0-9][0-9_]*+\\.([0-9_]++)?+" + EXP_REGEXP + "?+" + + "|" + "\\.[0-9][0-9_]*+" + EXP_REGEXP + "?+" + + "|" + "[0-9][0-9_]*+" + EXP_REGEXP + + // Hexadecimal + "|" + "0[xX][0-9_a-fA-F]++\\.[0-9_a-fA-F]*+" + BINARY_EXP_REGEXP + + "|" + "0[xX][0-9_a-fA-F]++" + BINARY_EXP_REGEXP + + ")"; + private static final String INTEGER_LITERAL_REGEXP = "(?:" + + // Hexadecimal + "0[xX][0-9_a-fA-F]++" + + // Binary (Java 7) + "|" + "0[bB][01_]++" + + // Decimal and Octal + "|" + "[0-9][0-9_]*+" + + ")"; private ObjectiveCLexer() { // prevents outside instantiation @@ -44,23 +67,37 @@ public static Lexer create() { public static Lexer create(ObjectiveCConfiguration conf) { return Lexer.builder() .withCharset(conf.getCharset()) + .withFailIfNoChannelToConsumeOneCharacter(true) - .withFailIfNoChannelToConsumeOneCharacter(false) + /* Remove whitespace */ + .withChannel(new BlackHoleChannel("\\s++")) /* Comments */ .withChannel(commentRegexp("//[^\\n\\r]*+")) - .withChannel(commentRegexp("/\\*[\\s\\S]*?\\*/")) + .withChannel(commentRegexp("/\\*", "[\\s\\S]*?", "\\*/")) + + /* Backslash at the end of the line: just throw away */ + .withChannel(new BackslashChannel()) + + /* Character literals */ + .withChannel(new CharacterLiteralsChannel()) + + /* String literals */ + .withChannel(new StringLiteralsChannel()) + + /* Number literals */ + .withChannel(regexp(FLOAT_LITERAL, FLOATING_LITERAL_WITHOUT_SUFFIX_REGEXP + "[fF]|[0-9][0-9_]*+[fF]")) + .withChannel(regexp(DOUBLE_LITERAL, FLOATING_LITERAL_WITHOUT_SUFFIX_REGEXP + "[dD]?+|[0-9][0-9_]*+[dD]")) + .withChannel(regexp(LONG_LITERAL, INTEGER_LITERAL_REGEXP + "[lL]")) + .withChannel(regexp(INTEGER_LITERAL, INTEGER_LITERAL_REGEXP)) /* Identifiers, keywords, and punctuators */ - .withChannel(new IdentifierAndKeywordChannel("(#|@)?[a-zA-Z]([a-zA-Z0-9_]*[a-zA-Z0-9])?+((\\s+)?\\*)?", true, ObjectiveCKeyword.values())) + .withChannel(new IdentifierAndKeywordChannel("[#@]?[a-zA-Z]([a-zA-Z0-9_]*[a-zA-Z0-9])?+((\\s+)?\\*)?", true, ObjectiveCKeyword.values())) .withChannel(new PunctuatorChannel(ObjectiveCPunctuator.values())) - /* All other tokens */ - .withChannel(regexp(LITERAL, "[^\r\n\\s/]+")) - - .withChannel(new BlackHoleChannel("[\\s]")) + /* All other tokens -- must be last channel */ + .withChannel(regexp(GenericTokenType.IDENTIFIER, "[^\r\n\\s/]+")) .build(); } - } diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/StringLiteralsChannel.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/StringLiteralsChannel.java new file mode 100644 index 00000000..1116acd6 --- /dev/null +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/StringLiteralsChannel.java @@ -0,0 +1,165 @@ +/* + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.objectivec.lexer; + +import com.sonar.sslr.api.Token; +import com.sonar.sslr.impl.Lexer; +import org.sonar.objectivec.api.ObjectiveCTokenType; +import org.sonar.sslr.channel.Channel; +import org.sonar.sslr.channel.CodeReader; + +/** + * @author Sonar C++ Plugin (Community) authors + */ +public class StringLiteralsChannel extends Channel { + private static final char EOF = (char) -1; + + private final StringBuilder sb = new StringBuilder(); + + private int index; + private char ch; + private boolean isRawString = false; + + @Override + public boolean consume(CodeReader code, Lexer output) { + int line = code.getLinePosition(); + int column = code.getColumnPosition(); + index = 0; + readStringPrefix(code); + if ((ch != '\"')) { + return false; + } + if (isRawString) { + if (!readRawString(code)) { + return false; + } + } else { + if (!readString(code)) { + return false; + } + } + readUdSuffix(code); + for (int i = 0; i < index; i++) { + sb.append((char) code.pop()); + } + output.addToken(Token.builder() + .setLine(line) + .setColumn(column) + .setURI(output.getURI()) + .setValueAndOriginalValue(sb.toString()) + .setType(ObjectiveCTokenType.STRING_LITERAL) + .build()); + sb.setLength(0); + return true; + } + + private boolean readString(CodeReader code) { + index++; + while (code.charAt(index) != ch) { + if (code.charAt(index) == EOF) { + return false; + } + if (code.charAt(index) == '\\') { + // escape + index++; + } + index++; + } + index++; + return true; + } + + private boolean readRawString(CodeReader code) { + // "delimiter( raw_character* )delimiter" + index++; + while (code.charAt(index) != '(') { // delimiter + if (code.charAt(index) == EOF) { + return false; + } + sb.append(code.charAt(index)); + index++; + } + String delimiter = sb.toString(); + do { + sb.setLength(0); + while (code.charAt(index) != ')') { // raw_character* + if (code.charAt(index) == EOF) { + return false; + } + index++; + } + index++; + while (code.charAt(index) != '"') { // delimiter + if (code.charAt(index) == EOF) { + return false; + } + sb.append(code.charAt(index)); + index++; + } + } while (!sb.toString().equals(delimiter)); + sb.setLength(0); + index++; + return true; + } + + private void readStringPrefix(CodeReader code) { + ch = code.charAt(index); + isRawString = false; + if ((ch == 'u') || (ch == 'U') || ch == 'L' || ch == '@') { + index++; + if (ch == 'u' && code.charAt(index) == '8') { + index++; + } + if (code.charAt(index) == ' ') + index++; + ch = code.charAt(index); + } + if (ch == 'R') { + index++; + isRawString = true; + ch = code.charAt(index); + } + } + + private void readUdSuffix(CodeReader code) { + for (int start_index = index, len = 0; ; index++) { + char c = code.charAt(index); + if (c == EOF) { + return; + } + if ((c >= 'a' && c <= 'z') + || (c >= 'A' && c <= 'Z') + || (c == '_')) { + len++; + } else { + if (c >= '0' && c <= '9') { + if (len > 0) { + len++; + } else { + index = start_index; + return; + } + } else { + return; + } + } + } + } +} diff --git a/sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/api/ObjectiveCPunctuatorTest.java b/sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/api/ObjectiveCPunctuatorTest.java index a451307c..126c21b9 100644 --- a/sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/api/ObjectiveCPunctuatorTest.java +++ b/sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/api/ObjectiveCPunctuatorTest.java @@ -28,7 +28,7 @@ public class ObjectiveCPunctuatorTest { @Test public void test() { - assertThat(ObjectiveCPunctuator.values().length, is(48)); + assertThat(ObjectiveCPunctuator.values().length, is(49)); } } diff --git a/sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java b/sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java index 8905db3f..65fa5a20 100644 --- a/sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java +++ b/sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java @@ -77,7 +77,7 @@ public void lexEmptyLine() { @Test public void lexSampleFile() { List tokens = lexer.lex(new File("src/test/resources/objcSample.h")); - assertThat(tokens.size(), equalTo(24)); + assertThat(tokens.size(), equalTo(26)); assertThat(tokens, hasToken(GenericTokenType.EOF)); } From a739365305e03878457f4624836daf87a21b1e07 Mon Sep 17 00:00:00 2001 From: Matthew DeTullio Date: Tue, 8 Mar 2016 19:25:24 -0500 Subject: [PATCH 38/42] Update SSLR dependencies and add SSLR Toolkit --- pom.xml | 29 ++--- sonar-objective-c-plugin/pom.xml | 24 +--- .../objectivec/ObjectiveCConfiguration.java | 2 +- sslr-objective-c-toolkit/pom.xml | 121 ++++++++++++++++++ .../toolkit/ObjectiveCConfigurationModel.java | 48 +++++++ .../objectivec/toolkit/ObjectiveCToolkit.java | 33 +++++ .../ObjectiveCConfigurationModelTest.java | 37 ++++++ 7 files changed, 252 insertions(+), 42 deletions(-) create mode 100644 sslr-objective-c-toolkit/pom.xml create mode 100644 sslr-objective-c-toolkit/src/main/java/org/sonar/objectivec/toolkit/ObjectiveCConfigurationModel.java create mode 100644 sslr-objective-c-toolkit/src/main/java/org/sonar/objectivec/toolkit/ObjectiveCToolkit.java create mode 100644 sslr-objective-c-toolkit/src/test/java/org/sonar/objectivec/toolkit/ObjectiveCConfigurationModelTest.java diff --git a/pom.xml b/pom.xml index 632b75aa..c9885e79 100644 --- a/pom.xml +++ b/pom.xml @@ -29,6 +29,7 @@ sonar-objective-c-plugin + sslr-objective-c-toolkit its @@ -96,7 +97,7 @@ ${project.organization.name} ${project.organization.url} 4.5.2 - 1.20 + 1.21 3.10.1 @@ -109,24 +110,24 @@ provided - org.codehaus.sonar.sslr + org.sonarsource.sslr sslr-core ${sslr.version} - org.codehaus.sonar.sslr + org.sonarsource.sslr sslr-xpath ${sslr.version} - org.codehaus.sonar.sslr + org.sonarsource.sslr sslr-toolkit ${sslr.version} - org.codehaus.sonar.sslr-squid-bridge + org.sonarsource.sslr-squid-bridge sslr-squid-bridge - 2.5.3 + 2.6.1 com.googlecode.plist @@ -141,7 +142,7 @@ test - org.codehaus.sonar.sslr + org.sonarsource.sslr sslr-testing-harness ${sslr.version} test @@ -149,19 +150,7 @@ junit junit - 4.10 - test - - - org.mockito - mockito-all - 1.9.0 - test - - - org.hamcrest - hamcrest-all - 1.1 + 4.12 test diff --git a/sonar-objective-c-plugin/pom.xml b/sonar-objective-c-plugin/pom.xml index 27a351ca..532273cd 100644 --- a/sonar-objective-c-plugin/pom.xml +++ b/sonar-objective-c-plugin/pom.xml @@ -30,19 +30,11 @@ provided - org.codehaus.sonar.sslr + org.sonarsource.sslr sslr-core - org.codehaus.sonar.sslr - sslr-xpath - - - org.codehaus.sonar.sslr - sslr-toolkit - - - org.codehaus.sonar.sslr-squid-bridge + org.sonarsource.sslr-squid-bridge sslr-squid-bridge @@ -56,7 +48,7 @@ test - org.codehaus.sonar.sslr + org.sonarsource.sslr sslr-testing-harness test @@ -65,16 +57,6 @@ junit test - - org.mockito - mockito-all - test - - - org.hamcrest - hamcrest-all - test - org.easytesting fest-assert diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java index 89fd3907..86330a9e 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java @@ -19,7 +19,7 @@ */ package org.sonar.objectivec; -import org.sonar.squid.api.SquidConfiguration; +import org.sonar.squidbridge.api.SquidConfiguration; import java.nio.charset.Charset; diff --git a/sslr-objective-c-toolkit/pom.xml b/sslr-objective-c-toolkit/pom.xml new file mode 100644 index 00000000..4ccda2fa --- /dev/null +++ b/sslr-objective-c-toolkit/pom.xml @@ -0,0 +1,121 @@ + + 4.0.0 + + + org.sonarqubecommunity.objectivec + objective-c + 0.5.0-SNAPSHOT + + + sslr-objective-c-toolkit + + SonarQube Objective-C (Community) :: SSLR Toolkit + + + + org.codehaus.sonar + sonar-plugin-api + provided + + + ${project.groupId} + sonar-objective-c-plugin + ${project.version} + + + org.sonarsource.sslr + sslr-toolkit + + + ch.qos.logback + logback-classic + + + junit + junit + test + + + org.easytesting + fest-assert + test + + + + + + + org.apache.maven.plugins + maven-jar-plugin + + + + org.sonar.objectivec.toolkit.ObjectiveCToolkit + + + + + + org.sonatype.plugins + jarjar-maven-plugin + + + package + + jarjar + + + + ${project.groupId}:sonar-objective-c-plugin + org.sonarsource.sslr:sslr-core + org.sonarsource.sslr:sslr-xpath + jaxen:jaxen + org.sonarsource.sslr:sslr-toolkit + org.sonarsource.sslr-squid-bridge:sslr-squid-bridge + org.codehaus.sonar:sonar-colorizer + org.codehaus.sonar:sonar-channel + org.slf4j:slf4j-api + org.slf4j:jcl-over-slf4j + ch.qos.logback:logback-classic + ch.qos.logback:logback-core + commons-io:commons-io + commons-lang:commons-lang + com.google.guava:guava + + + + *.** + + + + + + + + org.apache.maven.plugins + maven-enforcer-plugin + + + enforce-size + + enforce + + verify + + + + 4700000 + 4600000 + + ${project.build.directory}/${project.build.finalName}.jar + + + + + + + + + + diff --git a/sslr-objective-c-toolkit/src/main/java/org/sonar/objectivec/toolkit/ObjectiveCConfigurationModel.java b/sslr-objective-c-toolkit/src/main/java/org/sonar/objectivec/toolkit/ObjectiveCConfigurationModel.java new file mode 100644 index 00000000..1194f1a2 --- /dev/null +++ b/sslr-objective-c-toolkit/src/main/java/org/sonar/objectivec/toolkit/ObjectiveCConfigurationModel.java @@ -0,0 +1,48 @@ +/* + * SonarQube Objective-C (Community) :: SSLR Toolkit + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.objectivec.toolkit; + +import com.google.common.base.Charsets; +import com.sonar.sslr.impl.Parser; +import org.sonar.colorizer.Tokenizer; +import org.sonar.objectivec.ObjectiveCConfiguration; +import org.sonar.objectivec.parser.ObjectiveCParser; +import org.sonar.sslr.toolkit.AbstractConfigurationModel; +import org.sonar.sslr.toolkit.ConfigurationProperty; + +import java.util.Collections; +import java.util.List; + +public class ObjectiveCConfigurationModel extends AbstractConfigurationModel { + @Override + public List getProperties() { + return Collections.emptyList(); + } + + @Override + public Parser doGetParser() { + return ObjectiveCParser.create(new ObjectiveCConfiguration(Charsets.UTF_8)); + } + + @Override + public List doGetTokenizers() { + return Collections.emptyList(); + } +} diff --git a/sslr-objective-c-toolkit/src/main/java/org/sonar/objectivec/toolkit/ObjectiveCToolkit.java b/sslr-objective-c-toolkit/src/main/java/org/sonar/objectivec/toolkit/ObjectiveCToolkit.java new file mode 100644 index 00000000..bdf46b5d --- /dev/null +++ b/sslr-objective-c-toolkit/src/main/java/org/sonar/objectivec/toolkit/ObjectiveCToolkit.java @@ -0,0 +1,33 @@ +/* + * SonarQube Objective-C (Community) :: SSLR Toolkit + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.objectivec.toolkit; + +import org.sonar.sslr.toolkit.Toolkit; + +public final class ObjectiveCToolkit { + private ObjectiveCToolkit() { + // Prevents outside instantiation + } + + public static void main(String[] args) { + Toolkit toolkit = new Toolkit("SSLR :: Objective-C (Community) :: Toolkit", new ObjectiveCConfigurationModel()); + toolkit.run(); + } +} diff --git a/sslr-objective-c-toolkit/src/test/java/org/sonar/objectivec/toolkit/ObjectiveCConfigurationModelTest.java b/sslr-objective-c-toolkit/src/test/java/org/sonar/objectivec/toolkit/ObjectiveCConfigurationModelTest.java new file mode 100644 index 00000000..be5156fa --- /dev/null +++ b/sslr-objective-c-toolkit/src/test/java/org/sonar/objectivec/toolkit/ObjectiveCConfigurationModelTest.java @@ -0,0 +1,37 @@ +/* + * SonarQube Objective-C (Community) :: SSLR Toolkit + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.objectivec.toolkit; + +import org.junit.Test; + +import static org.fest.assertions.Assertions.assertThat; + +public class ObjectiveCConfigurationModelTest { + @Test + public void getProperties() { + ObjectiveCConfigurationModel model = new ObjectiveCConfigurationModel(); + assertThat(model.getProperties()).isEmpty(); + } + + @Test + public void getTokenizers() { + assertThat(new ObjectiveCConfigurationModel().getTokenizers()).isEmpty(); + } +} From 8b4cd855f8f7677527734f194077c432677e83dd Mon Sep 17 00:00:00 2001 From: Matthew DeTullio Date: Tue, 8 Mar 2016 19:58:59 -0500 Subject: [PATCH 39/42] Extract Squid into its own module --- objective-c-squid/pom.xml | 55 +++++++++++++++++++ .../objectivec/ObjectiveCAstScanner.java | 2 +- .../objectivec/ObjectiveCConfiguration.java | 2 +- .../objectivec/api/ObjectiveCGrammar.java | 2 +- .../objectivec/api/ObjectiveCKeyword.java | 2 +- .../objectivec/api/ObjectiveCMetric.java | 2 +- .../objectivec/api/ObjectiveCPunctuator.java | 2 +- .../objectivec/api/ObjectiveCTokenType.java | 2 +- .../sonar/objectivec/api/package-info.java | 2 +- .../sonar/objectivec/checks/CheckList.java | 2 +- .../sonar/objectivec/checks/package-info.java | 2 +- .../highlighter/SonarComponents.java | 2 +- .../highlighter/SyntaxHighlighterVisitor.java | 2 +- .../objectivec/highlighter/package-info.java | 2 +- .../objectivec/lexer/BackslashChannel.java | 2 +- .../lexer/CharacterLiteralsChannel.java | 2 +- .../objectivec/lexer/ObjectiveCLexer.java | 2 +- .../lexer/StringLiteralsChannel.java | 2 +- .../sonar/objectivec/lexer/package-info.java | 2 +- .../org/sonar/objectivec/package-info.java | 2 +- .../objectivec/parser/ObjectiveCParser.java | 2 +- .../sonar/objectivec/parser/package-info.java | 2 +- .../objectivec/ObjectiveCAstScannerTest.java | 2 +- .../api/ObjectiveCPunctuatorTest.java | 2 +- .../objectivec/lexer/ObjectiveCLexerTest.java | 2 +- .../src/test/resources/Profile.m | 0 .../src/test/resources/objcSample.h | 0 pom.xml | 1 + sonar-objective-c-plugin/pom.xml | 14 +---- .../plugins/objectivec/ObjectiveCPlugin.java | 2 + .../plugins/objectivec/ObjectiveCProfile.java | 1 + .../objectivec/ObjectiveCSquidSensor.java | 1 + .../objectivec/{ => api}/ObjectiveC.java | 2 +- .../objectivec/clang/ClangProfile.java | 2 +- .../clang/ClangProfileImporter.java | 2 +- .../clang/ClangRulesDefinition.java | 2 +- .../{ => cpd}/ObjectiveCCpdMapping.java | 3 +- .../{ => cpd}/ObjectiveCTokenizer.java | 2 +- .../objectivec/lizard/LizardSensor.java | 2 +- .../objectivec/oclint/OCLintProfile.java | 2 +- .../oclint/OCLintProfileImporter.java | 2 +- .../oclint/OCLintRulesDefinition.java | 2 +- sslr-objective-c-toolkit/pom.xml | 8 +-- 43 files changed, 102 insertions(+), 49 deletions(-) create mode 100644 objective-c-squid/pom.xml rename {sonar-objective-c-plugin => objective-c-squid}/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java (99%) rename {sonar-objective-c-plugin => objective-c-squid}/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java (96%) rename {sonar-objective-c-plugin => objective-c-squid}/src/main/java/org/sonar/objectivec/api/ObjectiveCGrammar.java (96%) rename {sonar-objective-c-plugin => objective-c-squid}/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java (99%) rename {sonar-objective-c-plugin => objective-c-squid}/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java (97%) rename {sonar-objective-c-plugin => objective-c-squid}/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java (98%) rename {sonar-objective-c-plugin => objective-c-squid}/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java (97%) rename {sonar-objective-c-plugin => objective-c-squid}/src/main/java/org/sonar/objectivec/api/package-info.java (95%) rename {sonar-objective-c-plugin => objective-c-squid}/src/main/java/org/sonar/objectivec/checks/CheckList.java (96%) rename {sonar-objective-c-plugin => objective-c-squid}/src/main/java/org/sonar/objectivec/checks/package-info.java (95%) rename {sonar-objective-c-plugin => objective-c-squid}/src/main/java/org/sonar/objectivec/highlighter/SonarComponents.java (97%) rename {sonar-objective-c-plugin => objective-c-squid}/src/main/java/org/sonar/objectivec/highlighter/SyntaxHighlighterVisitor.java (99%) rename {sonar-objective-c-plugin => objective-c-squid}/src/main/java/org/sonar/objectivec/highlighter/package-info.java (95%) rename {sonar-objective-c-plugin => objective-c-squid}/src/main/java/org/sonar/objectivec/lexer/BackslashChannel.java (97%) rename {sonar-objective-c-plugin => objective-c-squid}/src/main/java/org/sonar/objectivec/lexer/CharacterLiteralsChannel.java (98%) rename {sonar-objective-c-plugin => objective-c-squid}/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java (99%) rename {sonar-objective-c-plugin => objective-c-squid}/src/main/java/org/sonar/objectivec/lexer/StringLiteralsChannel.java (99%) rename {sonar-objective-c-plugin => objective-c-squid}/src/main/java/org/sonar/objectivec/lexer/package-info.java (95%) rename {sonar-objective-c-plugin => objective-c-squid}/src/main/java/org/sonar/objectivec/package-info.java (95%) rename {sonar-objective-c-plugin => objective-c-squid}/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java (97%) rename {sonar-objective-c-plugin => objective-c-squid}/src/main/java/org/sonar/objectivec/parser/package-info.java (95%) rename {sonar-objective-c-plugin => objective-c-squid}/src/test/java/org/sonar/objectivec/ObjectiveCAstScannerTest.java (97%) rename {sonar-objective-c-plugin => objective-c-squid}/src/test/java/org/sonar/objectivec/api/ObjectiveCPunctuatorTest.java (96%) rename {sonar-objective-c-plugin => objective-c-squid}/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java (98%) rename {sonar-objective-c-plugin => objective-c-squid}/src/test/resources/Profile.m (100%) rename {sonar-objective-c-plugin => objective-c-squid}/src/test/resources/objcSample.h (100%) rename sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/{ => api}/ObjectiveC.java (98%) rename sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/{ => cpd}/ObjectiveCCpdMapping.java (94%) rename sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/{ => cpd}/ObjectiveCTokenizer.java (98%) diff --git a/objective-c-squid/pom.xml b/objective-c-squid/pom.xml new file mode 100644 index 00000000..73a4be35 --- /dev/null +++ b/objective-c-squid/pom.xml @@ -0,0 +1,55 @@ + + 4.0.0 + + + org.sonarqubecommunity.objectivec + objective-c + 0.5.0-SNAPSHOT + + + objective-c-squid + + SonarQube Objective-C (Community) :: Squid + + + + org.codehaus.sonar + sonar-plugin-api + + + org.sonarsource.sslr + sslr-core + + + org.sonarsource.sslr-squid-bridge + sslr-squid-bridge + + + + org.codehaus.sonar + sonar-testing-harness + test + + + org.sonarsource.sslr + sslr-testing-harness + test + + + junit + junit + test + + + org.easytesting + fest-assert + test + + + ch.qos.logback + logback-classic + test + + + diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java b/objective-c-squid/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java similarity index 99% rename from sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java rename to objective-c-squid/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java index 676d2726..6ccc5f04 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java +++ b/objective-c-squid/src/main/java/org/sonar/objectivec/ObjectiveCAstScanner.java @@ -1,5 +1,5 @@ /* - * SonarQube Objective-C (Community) Plugin + * SonarQube Objective-C (Community) :: Squid * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors * mailto:sonarqube@googlegroups.com * diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java b/objective-c-squid/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java similarity index 96% rename from sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java rename to objective-c-squid/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java index 86330a9e..1a424d21 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java +++ b/objective-c-squid/src/main/java/org/sonar/objectivec/ObjectiveCConfiguration.java @@ -1,5 +1,5 @@ /* - * SonarQube Objective-C (Community) Plugin + * SonarQube Objective-C (Community) :: Squid * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors * mailto:sonarqube@googlegroups.com * diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCGrammar.java b/objective-c-squid/src/main/java/org/sonar/objectivec/api/ObjectiveCGrammar.java similarity index 96% rename from sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCGrammar.java rename to objective-c-squid/src/main/java/org/sonar/objectivec/api/ObjectiveCGrammar.java index 5043dcce..fe2f1146 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCGrammar.java +++ b/objective-c-squid/src/main/java/org/sonar/objectivec/api/ObjectiveCGrammar.java @@ -1,5 +1,5 @@ /* - * SonarQube Objective-C (Community) Plugin + * SonarQube Objective-C (Community) :: Squid * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors * mailto:sonarqube@googlegroups.com * diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java b/objective-c-squid/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java similarity index 99% rename from sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java rename to objective-c-squid/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java index 34ab334b..142e7e6a 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java +++ b/objective-c-squid/src/main/java/org/sonar/objectivec/api/ObjectiveCKeyword.java @@ -1,5 +1,5 @@ /* - * SonarQube Objective-C (Community) Plugin + * SonarQube Objective-C (Community) :: Squid * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors * mailto:sonarqube@googlegroups.com * diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java b/objective-c-squid/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java similarity index 97% rename from sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java rename to objective-c-squid/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java index c8edcd1b..194dcd17 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java +++ b/objective-c-squid/src/main/java/org/sonar/objectivec/api/ObjectiveCMetric.java @@ -1,5 +1,5 @@ /* - * SonarQube Objective-C (Community) Plugin + * SonarQube Objective-C (Community) :: Squid * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors * mailto:sonarqube@googlegroups.com * diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java b/objective-c-squid/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java similarity index 98% rename from sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java rename to objective-c-squid/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java index d0892f37..d917db2f 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java +++ b/objective-c-squid/src/main/java/org/sonar/objectivec/api/ObjectiveCPunctuator.java @@ -1,5 +1,5 @@ /* - * SonarQube Objective-C (Community) Plugin + * SonarQube Objective-C (Community) :: Squid * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors * mailto:sonarqube@googlegroups.com * diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java b/objective-c-squid/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java similarity index 97% rename from sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java rename to objective-c-squid/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java index ca0c79ec..43712110 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java +++ b/objective-c-squid/src/main/java/org/sonar/objectivec/api/ObjectiveCTokenType.java @@ -1,5 +1,5 @@ /* - * SonarQube Objective-C (Community) Plugin + * SonarQube Objective-C (Community) :: Squid * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors * mailto:sonarqube@googlegroups.com * diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/package-info.java b/objective-c-squid/src/main/java/org/sonar/objectivec/api/package-info.java similarity index 95% rename from sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/package-info.java rename to objective-c-squid/src/main/java/org/sonar/objectivec/api/package-info.java index 33f68629..176f3d34 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/api/package-info.java +++ b/objective-c-squid/src/main/java/org/sonar/objectivec/api/package-info.java @@ -1,5 +1,5 @@ /* - * SonarQube Objective-C (Community) Plugin + * SonarQube Objective-C (Community) :: Squid * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors * mailto:sonarqube@googlegroups.com * diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/checks/CheckList.java b/objective-c-squid/src/main/java/org/sonar/objectivec/checks/CheckList.java similarity index 96% rename from sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/checks/CheckList.java rename to objective-c-squid/src/main/java/org/sonar/objectivec/checks/CheckList.java index bc1a9cce..0d9c55eb 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/checks/CheckList.java +++ b/objective-c-squid/src/main/java/org/sonar/objectivec/checks/CheckList.java @@ -1,5 +1,5 @@ /* - * SonarQube Objective-C (Community) Plugin + * SonarQube Objective-C (Community) :: Squid * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors * mailto:sonarqube@googlegroups.com * diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/checks/package-info.java b/objective-c-squid/src/main/java/org/sonar/objectivec/checks/package-info.java similarity index 95% rename from sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/checks/package-info.java rename to objective-c-squid/src/main/java/org/sonar/objectivec/checks/package-info.java index c4dff5c7..64255f1c 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/checks/package-info.java +++ b/objective-c-squid/src/main/java/org/sonar/objectivec/checks/package-info.java @@ -1,5 +1,5 @@ /* - * SonarQube Objective-C (Community) Plugin + * SonarQube Objective-C (Community) :: Squid * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors * mailto:sonarqube@googlegroups.com * diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/SonarComponents.java b/objective-c-squid/src/main/java/org/sonar/objectivec/highlighter/SonarComponents.java similarity index 97% rename from sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/SonarComponents.java rename to objective-c-squid/src/main/java/org/sonar/objectivec/highlighter/SonarComponents.java index fdaa0319..422e288a 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/SonarComponents.java +++ b/objective-c-squid/src/main/java/org/sonar/objectivec/highlighter/SonarComponents.java @@ -1,5 +1,5 @@ /* - * SonarQube Objective-C (Community) Plugin + * SonarQube Objective-C (Community) :: Squid * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors * mailto:sonarqube@googlegroups.com * diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/SyntaxHighlighterVisitor.java b/objective-c-squid/src/main/java/org/sonar/objectivec/highlighter/SyntaxHighlighterVisitor.java similarity index 99% rename from sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/SyntaxHighlighterVisitor.java rename to objective-c-squid/src/main/java/org/sonar/objectivec/highlighter/SyntaxHighlighterVisitor.java index 16437408..c9ba113a 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/SyntaxHighlighterVisitor.java +++ b/objective-c-squid/src/main/java/org/sonar/objectivec/highlighter/SyntaxHighlighterVisitor.java @@ -1,5 +1,5 @@ /* - * SonarQube Objective-C (Community) Plugin + * SonarQube Objective-C (Community) :: Squid * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors * mailto:sonarqube@googlegroups.com * diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/package-info.java b/objective-c-squid/src/main/java/org/sonar/objectivec/highlighter/package-info.java similarity index 95% rename from sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/package-info.java rename to objective-c-squid/src/main/java/org/sonar/objectivec/highlighter/package-info.java index 1054849a..0d67a3fd 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/highlighter/package-info.java +++ b/objective-c-squid/src/main/java/org/sonar/objectivec/highlighter/package-info.java @@ -1,5 +1,5 @@ /* - * SonarQube Objective-C (Community) Plugin + * SonarQube Objective-C (Community) :: Squid * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors * mailto:sonarqube@googlegroups.com * diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/BackslashChannel.java b/objective-c-squid/src/main/java/org/sonar/objectivec/lexer/BackslashChannel.java similarity index 97% rename from sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/BackslashChannel.java rename to objective-c-squid/src/main/java/org/sonar/objectivec/lexer/BackslashChannel.java index a05d355b..4bdaf728 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/BackslashChannel.java +++ b/objective-c-squid/src/main/java/org/sonar/objectivec/lexer/BackslashChannel.java @@ -1,5 +1,5 @@ /* - * SonarQube Objective-C (Community) Plugin + * SonarQube Objective-C (Community) :: Squid * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors * mailto:sonarqube@googlegroups.com * diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/CharacterLiteralsChannel.java b/objective-c-squid/src/main/java/org/sonar/objectivec/lexer/CharacterLiteralsChannel.java similarity index 98% rename from sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/CharacterLiteralsChannel.java rename to objective-c-squid/src/main/java/org/sonar/objectivec/lexer/CharacterLiteralsChannel.java index 3fd75e11..bb3c603a 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/CharacterLiteralsChannel.java +++ b/objective-c-squid/src/main/java/org/sonar/objectivec/lexer/CharacterLiteralsChannel.java @@ -1,5 +1,5 @@ /* - * SonarQube Objective-C (Community) Plugin + * SonarQube Objective-C (Community) :: Squid * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors * mailto:sonarqube@googlegroups.com * diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java b/objective-c-squid/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java similarity index 99% rename from sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java rename to objective-c-squid/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java index 040c6493..4d97e16c 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java +++ b/objective-c-squid/src/main/java/org/sonar/objectivec/lexer/ObjectiveCLexer.java @@ -1,5 +1,5 @@ /* - * SonarQube Objective-C (Community) Plugin + * SonarQube Objective-C (Community) :: Squid * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors * mailto:sonarqube@googlegroups.com * diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/StringLiteralsChannel.java b/objective-c-squid/src/main/java/org/sonar/objectivec/lexer/StringLiteralsChannel.java similarity index 99% rename from sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/StringLiteralsChannel.java rename to objective-c-squid/src/main/java/org/sonar/objectivec/lexer/StringLiteralsChannel.java index 1116acd6..0ce6e785 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/StringLiteralsChannel.java +++ b/objective-c-squid/src/main/java/org/sonar/objectivec/lexer/StringLiteralsChannel.java @@ -1,5 +1,5 @@ /* - * SonarQube Objective-C (Community) Plugin + * SonarQube Objective-C (Community) :: Squid * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors * mailto:sonarqube@googlegroups.com * diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/package-info.java b/objective-c-squid/src/main/java/org/sonar/objectivec/lexer/package-info.java similarity index 95% rename from sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/package-info.java rename to objective-c-squid/src/main/java/org/sonar/objectivec/lexer/package-info.java index 31ac5496..fb8724fa 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/lexer/package-info.java +++ b/objective-c-squid/src/main/java/org/sonar/objectivec/lexer/package-info.java @@ -1,5 +1,5 @@ /* - * SonarQube Objective-C (Community) Plugin + * SonarQube Objective-C (Community) :: Squid * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors * mailto:sonarqube@googlegroups.com * diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/package-info.java b/objective-c-squid/src/main/java/org/sonar/objectivec/package-info.java similarity index 95% rename from sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/package-info.java rename to objective-c-squid/src/main/java/org/sonar/objectivec/package-info.java index 7786918c..424a3dbb 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/package-info.java +++ b/objective-c-squid/src/main/java/org/sonar/objectivec/package-info.java @@ -1,5 +1,5 @@ /* - * SonarQube Objective-C (Community) Plugin + * SonarQube Objective-C (Community) :: Squid * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors * mailto:sonarqube@googlegroups.com * diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java b/objective-c-squid/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java similarity index 97% rename from sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java rename to objective-c-squid/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java index 3a4a14b2..3fbda558 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java +++ b/objective-c-squid/src/main/java/org/sonar/objectivec/parser/ObjectiveCParser.java @@ -1,5 +1,5 @@ /* - * SonarQube Objective-C (Community) Plugin + * SonarQube Objective-C (Community) :: Squid * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors * mailto:sonarqube@googlegroups.com * diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/parser/package-info.java b/objective-c-squid/src/main/java/org/sonar/objectivec/parser/package-info.java similarity index 95% rename from sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/parser/package-info.java rename to objective-c-squid/src/main/java/org/sonar/objectivec/parser/package-info.java index b84ce086..4b22d0b6 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/objectivec/parser/package-info.java +++ b/objective-c-squid/src/main/java/org/sonar/objectivec/parser/package-info.java @@ -1,5 +1,5 @@ /* - * SonarQube Objective-C (Community) Plugin + * SonarQube Objective-C (Community) :: Squid * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors * mailto:sonarqube@googlegroups.com * diff --git a/sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/ObjectiveCAstScannerTest.java b/objective-c-squid/src/test/java/org/sonar/objectivec/ObjectiveCAstScannerTest.java similarity index 97% rename from sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/ObjectiveCAstScannerTest.java rename to objective-c-squid/src/test/java/org/sonar/objectivec/ObjectiveCAstScannerTest.java index 4771bccf..2988862a 100644 --- a/sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/ObjectiveCAstScannerTest.java +++ b/objective-c-squid/src/test/java/org/sonar/objectivec/ObjectiveCAstScannerTest.java @@ -1,5 +1,5 @@ /* - * SonarQube Objective-C (Community) Plugin + * SonarQube Objective-C (Community) :: Squid * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors * mailto:sonarqube@googlegroups.com * diff --git a/sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/api/ObjectiveCPunctuatorTest.java b/objective-c-squid/src/test/java/org/sonar/objectivec/api/ObjectiveCPunctuatorTest.java similarity index 96% rename from sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/api/ObjectiveCPunctuatorTest.java rename to objective-c-squid/src/test/java/org/sonar/objectivec/api/ObjectiveCPunctuatorTest.java index 126c21b9..8fac9bb1 100644 --- a/sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/api/ObjectiveCPunctuatorTest.java +++ b/objective-c-squid/src/test/java/org/sonar/objectivec/api/ObjectiveCPunctuatorTest.java @@ -1,5 +1,5 @@ /* - * SonarQube Objective-C (Community) Plugin + * SonarQube Objective-C (Community) :: Squid * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors * mailto:sonarqube@googlegroups.com * diff --git a/sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java b/objective-c-squid/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java similarity index 98% rename from sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java rename to objective-c-squid/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java index 65fa5a20..80fb27f7 100644 --- a/sonar-objective-c-plugin/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java +++ b/objective-c-squid/src/test/java/org/sonar/objectivec/lexer/ObjectiveCLexerTest.java @@ -1,5 +1,5 @@ /* - * SonarQube Objective-C (Community) Plugin + * SonarQube Objective-C (Community) :: Squid * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors * mailto:sonarqube@googlegroups.com * diff --git a/sonar-objective-c-plugin/src/test/resources/Profile.m b/objective-c-squid/src/test/resources/Profile.m similarity index 100% rename from sonar-objective-c-plugin/src/test/resources/Profile.m rename to objective-c-squid/src/test/resources/Profile.m diff --git a/sonar-objective-c-plugin/src/test/resources/objcSample.h b/objective-c-squid/src/test/resources/objcSample.h similarity index 100% rename from sonar-objective-c-plugin/src/test/resources/objcSample.h rename to objective-c-squid/src/test/resources/objcSample.h diff --git a/pom.xml b/pom.xml index c9885e79..ab48fc98 100644 --- a/pom.xml +++ b/pom.xml @@ -28,6 +28,7 @@ + objective-c-squid sonar-objective-c-plugin sslr-objective-c-toolkit its diff --git a/sonar-objective-c-plugin/pom.xml b/sonar-objective-c-plugin/pom.xml index 532273cd..7063dc7e 100644 --- a/sonar-objective-c-plugin/pom.xml +++ b/sonar-objective-c-plugin/pom.xml @@ -30,12 +30,9 @@ provided - org.sonarsource.sslr - sslr-core - - - org.sonarsource.sslr-squid-bridge - sslr-squid-bridge + ${project.groupId} + objective-c-squid + ${project.version} com.googlecode.plist @@ -47,11 +44,6 @@ sonar-testing-harness test - - org.sonarsource.sslr - sslr-testing-harness - test - junit junit diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java index 816f58c2..b4715cd3 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java @@ -22,11 +22,13 @@ import org.sonar.api.SonarPlugin; import org.sonar.api.config.PropertyDefinition; import org.sonar.api.resources.Qualifiers; +import org.sonar.plugins.objectivec.api.ObjectiveC; import org.sonar.plugins.objectivec.clang.ClangProfile; import org.sonar.plugins.objectivec.clang.ClangProfileImporter; import org.sonar.plugins.objectivec.clang.ClangRulesDefinition; import org.sonar.plugins.objectivec.clang.ClangSensor; import org.sonar.plugins.objectivec.cobertura.CoberturaSensor; +import org.sonar.plugins.objectivec.cpd.ObjectiveCCpdMapping; import org.sonar.plugins.objectivec.lizard.LizardSensor; import org.sonar.plugins.objectivec.oclint.OCLintProfile; import org.sonar.plugins.objectivec.oclint.OCLintProfileImporter; diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCProfile.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCProfile.java index c2bac26c..376eb542 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCProfile.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCProfile.java @@ -24,6 +24,7 @@ import org.sonar.api.profiles.RulesProfile; import org.sonar.api.utils.ValidationMessages; import org.sonar.objectivec.checks.CheckList; +import org.sonar.plugins.objectivec.api.ObjectiveC; public class ObjectiveCProfile extends ProfileDefinition { diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java index 8ea2bcd0..d9c03ee8 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCSquidSensor.java @@ -42,6 +42,7 @@ import org.sonar.objectivec.api.ObjectiveCMetric; import org.sonar.objectivec.checks.CheckList; import org.sonar.objectivec.highlighter.SonarComponents; +import org.sonar.plugins.objectivec.api.ObjectiveC; import org.sonar.squidbridge.AstScanner; import org.sonar.squidbridge.SquidAstVisitor; import org.sonar.squidbridge.api.CheckMessage; diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/api/ObjectiveC.java similarity index 98% rename from sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/api/ObjectiveC.java index ba2ac7f7..08c8cea2 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveC.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/api/ObjectiveC.java @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.plugins.objectivec; +package org.sonar.plugins.objectivec.api; import com.google.common.collect.Lists; import org.apache.commons.lang.StringUtils; diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfile.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfile.java index 4360e4da..3070c262 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfile.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfile.java @@ -24,7 +24,7 @@ import org.sonar.api.profiles.ProfileDefinition; import org.sonar.api.profiles.RulesProfile; import org.sonar.api.utils.ValidationMessages; -import org.sonar.plugins.objectivec.ObjectiveC; +import org.sonar.plugins.objectivec.api.ObjectiveC; import java.io.IOException; import java.io.InputStreamReader; diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfileImporter.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfileImporter.java index 415b4ce0..1fde82c3 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfileImporter.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangProfileImporter.java @@ -25,7 +25,7 @@ import org.sonar.api.profiles.RulesProfile; import org.sonar.api.profiles.XMLProfileParser; import org.sonar.api.utils.ValidationMessages; -import org.sonar.plugins.objectivec.ObjectiveC; +import org.sonar.plugins.objectivec.api.ObjectiveC; import java.io.Reader; diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java index e49a31a0..d72d0c25 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java @@ -22,7 +22,7 @@ import com.google.common.collect.ImmutableMap; import org.sonar.api.server.rule.RulesDefinition; import org.sonar.api.server.rule.RulesDefinitionXmlLoader; -import org.sonar.plugins.objectivec.ObjectiveC; +import org.sonar.plugins.objectivec.api.ObjectiveC; import org.sonar.squidbridge.rules.SqaleXmlLoader; import java.util.Map; diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCCpdMapping.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/cpd/ObjectiveCCpdMapping.java similarity index 94% rename from sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCCpdMapping.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/cpd/ObjectiveCCpdMapping.java index c8386e0c..aadc15a3 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCCpdMapping.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/cpd/ObjectiveCCpdMapping.java @@ -17,12 +17,13 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.plugins.objectivec; +package org.sonar.plugins.objectivec.cpd; import net.sourceforge.pmd.cpd.Tokenizer; import org.sonar.api.batch.AbstractCpdMapping; import org.sonar.api.batch.fs.FileSystem; import org.sonar.api.resources.Language; +import org.sonar.plugins.objectivec.api.ObjectiveC; import java.nio.charset.Charset; diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCTokenizer.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/cpd/ObjectiveCTokenizer.java similarity index 98% rename from sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCTokenizer.java rename to sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/cpd/ObjectiveCTokenizer.java index 8557d807..b2565310 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCTokenizer.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/cpd/ObjectiveCTokenizer.java @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software Foundation, * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -package org.sonar.plugins.objectivec; +package org.sonar.plugins.objectivec.cpd; import com.sonar.sslr.api.Token; import com.sonar.sslr.impl.Lexer; diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java index 7f9c28b3..d2be66d4 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java @@ -31,7 +31,7 @@ import org.sonar.api.resources.Project; import org.sonar.api.resources.Resource; import org.sonar.api.scan.filesystem.PathResolver; -import org.sonar.plugins.objectivec.ObjectiveC; +import org.sonar.plugins.objectivec.api.ObjectiveC; import java.io.File; import java.util.List; diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java index d498952e..a5f11733 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfile.java @@ -24,7 +24,7 @@ import org.sonar.api.profiles.ProfileDefinition; import org.sonar.api.profiles.RulesProfile; import org.sonar.api.utils.ValidationMessages; -import org.sonar.plugins.objectivec.ObjectiveC; +import org.sonar.plugins.objectivec.api.ObjectiveC; import java.io.IOException; import java.io.InputStreamReader; diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfileImporter.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfileImporter.java index 9a7c8b89..205ff16a 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfileImporter.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintProfileImporter.java @@ -25,7 +25,7 @@ import org.sonar.api.profiles.RulesProfile; import org.sonar.api.profiles.XMLProfileParser; import org.sonar.api.utils.ValidationMessages; -import org.sonar.plugins.objectivec.ObjectiveC; +import org.sonar.plugins.objectivec.api.ObjectiveC; import java.io.Reader; diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintRulesDefinition.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintRulesDefinition.java index f310fbc7..cb80925b 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintRulesDefinition.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/oclint/OCLintRulesDefinition.java @@ -21,7 +21,7 @@ import org.sonar.api.server.rule.RulesDefinition; import org.sonar.api.server.rule.RulesDefinitionXmlLoader; -import org.sonar.plugins.objectivec.ObjectiveC; +import org.sonar.plugins.objectivec.api.ObjectiveC; import org.sonar.squidbridge.rules.SqaleXmlLoader; public final class OCLintRulesDefinition implements RulesDefinition { diff --git a/sslr-objective-c-toolkit/pom.xml b/sslr-objective-c-toolkit/pom.xml index 4ccda2fa..425c1e8d 100644 --- a/sslr-objective-c-toolkit/pom.xml +++ b/sslr-objective-c-toolkit/pom.xml @@ -20,7 +20,7 @@ ${project.groupId} - sonar-objective-c-plugin + objective-c-squid ${project.version} @@ -67,7 +67,7 @@ - ${project.groupId}:sonar-objective-c-plugin + ${project.groupId}:objective-c-squid org.sonarsource.sslr:sslr-core org.sonarsource.sslr:sslr-xpath jaxen:jaxen @@ -105,8 +105,8 @@ - 4700000 - 4600000 + 3500000 + 3400000 ${project.build.directory}/${project.build.finalName}.jar From 23b5ec0a3b9dc6a0136a077f9ff60179585983de Mon Sep 17 00:00:00 2001 From: Matthew DeTullio Date: Tue, 15 Mar 2016 16:17:12 -0400 Subject: [PATCH 40/42] Implement file and function complexity issues based on Lizard report. --- .../plugins/objectivec/ObjectiveCPlugin.java | 2 + .../objectivec/lizard/LizardReportParser.java | 121 +++++++++++++++++- .../lizard/LizardRulesDefinition.java | 84 ++++++++++++ .../objectivec/lizard/LizardSensor.java | 12 +- .../lizard/LizardReportParserTest.java | 42 ++++-- 5 files changed, 241 insertions(+), 20 deletions(-) create mode 100644 sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardRulesDefinition.java diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java index b4715cd3..6d4820e9 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/ObjectiveCPlugin.java @@ -29,6 +29,7 @@ import org.sonar.plugins.objectivec.clang.ClangSensor; import org.sonar.plugins.objectivec.cobertura.CoberturaSensor; import org.sonar.plugins.objectivec.cpd.ObjectiveCCpdMapping; +import org.sonar.plugins.objectivec.lizard.LizardRulesDefinition; import org.sonar.plugins.objectivec.lizard.LizardSensor; import org.sonar.plugins.objectivec.oclint.OCLintProfile; import org.sonar.plugins.objectivec.oclint.OCLintProfileImporter; @@ -77,6 +78,7 @@ public List getExtensions() { .build()); extensions.add(LizardSensor.class); + extensions.add(LizardRulesDefinition.class); extensions.add(PropertyDefinition.builder(LizardSensor.REPORT_PATH_KEY) .name("Report path") .description("Path (absolute or relative) to Lizard XML report file.") diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardReportParser.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardReportParser.java index 243f2296..ea5afc44 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardReportParser.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardReportParser.java @@ -21,10 +21,20 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.sonar.api.batch.SensorContext; +import org.sonar.api.batch.fs.FileSystem; +import org.sonar.api.batch.fs.InputFile; +import org.sonar.api.component.ResourcePerspectives; +import org.sonar.api.issue.Issuable; +import org.sonar.api.issue.Issue; import org.sonar.api.measures.CoreMetrics; import org.sonar.api.measures.Measure; import org.sonar.api.measures.PersistenceMode; import org.sonar.api.measures.RangeDistributionBuilder; +import org.sonar.api.profiles.RulesProfile; +import org.sonar.api.resources.Resource; +import org.sonar.api.rule.RuleKey; +import org.sonar.api.rules.ActiveRule; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.Node; @@ -67,8 +77,17 @@ public final class LizardReportParser { private static final Number[] FUNCTIONS_DISTRIB_BOTTOM_LIMITS = {1, 2, 4, 6, 8, 10, 12, 20, 30}; private static final Number[] FILES_DISTRIB_BOTTOM_LIMITS = {0, 5, 10, 20, 30, 60, 90}; - private LizardReportParser() { - // Prevent outside instantiation + private final FileSystem fileSystem; + private final ResourcePerspectives resourcePerspectives; + private final RulesProfile rulesProfile; + private final SensorContext sensorContext; + + private LizardReportParser(final FileSystem fileSystem, final ResourcePerspectives resourcePerspectives, + final RulesProfile rulesProfile, final SensorContext sensorContext) { + this.fileSystem = fileSystem; + this.resourcePerspectives = resourcePerspectives; + this.rulesProfile = rulesProfile; + this.sensorContext = sensorContext; } /** @@ -76,14 +95,16 @@ private LizardReportParser() { * @return Map containing as key the name of the file and as value a list containing the measures for that file */ @CheckForNull - public static Map> parseReport(final File xmlFile) { + public static Map> parseReport(final FileSystem fileSystem, + final ResourcePerspectives resourcePerspectives, final RulesProfile rulesProfile, + final SensorContext sensorContext, final File xmlFile) { Map> result = null; DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); try { DocumentBuilder builder = factory.newDocumentBuilder(); Document document = builder.parse(xmlFile); - result = new LizardReportParser().parseFile(document); + result = new LizardReportParser(fileSystem, resourcePerspectives, rulesProfile, sensorContext).parseFile(document); } catch (final FileNotFoundException e) { LOGGER.error("Lizard Report not found {}", xmlFile, e); } catch (final IOException | ParserConfigurationException | SAXException e) { @@ -197,6 +218,7 @@ private void addComplexityFunctionMeasures(Map> reportMeas complexityDistribution.add(func.getCyclomaticComplexity()); count++; complexityInFunctions += func.getCyclomaticComplexity(); + createFunctionComplexityIssue(entry.getKey(), func); } } @@ -205,23 +227,110 @@ private void addComplexityFunctionMeasures(Map> reportMeas for (Measure m : entry.getValue()) { if (m.getMetric().getKey().equalsIgnoreCase(CoreMetrics.FILE_COMPLEXITY.getKey())) { complex = m.getValue(); + createFileComplexityIssue(entry.getKey(), (int) complex); break; } } double complexMean = complex / (double) count; - entry.getValue().addAll(buildFuncionMeasuresList(complexMean, complexityInFunctions, complexityDistribution)); + entry.getValue().addAll(buildFunctionMeasuresList(complexMean, complexityInFunctions, complexityDistribution)); } } } + private void createFileComplexityIssue(String fileName, int complexity) { + ActiveRule activeRule = rulesProfile.getActiveRule( + LizardRulesDefinition.REPOSITORY_KEY, + LizardRulesDefinition.FILE_CYCLOMATIC_COMPLEXITY_RULE_KEY); + + if (activeRule == null) { + // Rule is not active + return; + } + + int threshold = Integer.parseInt(activeRule.getParameter(LizardRulesDefinition.FILE_CYCLOMATIC_COMPLEXITY_PARAM_KEY)); + + if (complexity <= threshold) { + // Complexity is lower or equal to the defined threshold + return; + } + + final InputFile inputFile = fileSystem.inputFile(fileSystem.predicates().hasPath(fileName)); + final Resource resource = inputFile == null ? null : sensorContext.getResource(inputFile); + + if (resource == null) { + LOGGER.debug("Skipping file (not found in index): {}", fileName); + return; + } + + Issuable issuable = resourcePerspectives.as(Issuable.class, resource); + + if (issuable != null) { + Issue issue = issuable.newIssueBuilder() + .ruleKey(RuleKey.of(LizardRulesDefinition.REPOSITORY_KEY, LizardRulesDefinition.FILE_CYCLOMATIC_COMPLEXITY_RULE_KEY)) + .message(String.format("The Cyclomatic Complexity of this file \"%s\" is %d which is greater than %d authorized.", fileName, complexity, threshold)) + .effortToFix((double) (complexity - threshold)) + .build(); + + issuable.addIssue(issue); + } + } + + private void createFunctionComplexityIssue(String fileName, ObjCFunction func) { + ActiveRule activeRule = rulesProfile.getActiveRule( + LizardRulesDefinition.REPOSITORY_KEY, + LizardRulesDefinition.FUNCTION_CYCLOMATIC_COMPLEXITY_RULE_KEY); + + if (activeRule == null) { + // Rule is not active + return; + } + + int complexity = func.getCyclomaticComplexity(); + int threshold = Integer.parseInt(activeRule.getParameter(LizardRulesDefinition.FUNCTION_CYCLOMATIC_COMPLEXITY_PARAM_KEY)); + + if (complexity <= threshold) { + // Complexity is lower or equal to the defined threshold + return; + } + + final InputFile inputFile = fileSystem.inputFile(fileSystem.predicates().hasPath(fileName)); + final Resource resource = inputFile == null ? null : sensorContext.getResource(inputFile); + + if (resource == null) { + LOGGER.debug("Skipping file (not found in index): {}", fileName); + return; + } + + Issuable issuable = resourcePerspectives.as(Issuable.class, resource); + + if (issuable != null) { + String name = func.getName(); + + int lastColonIndex = name.lastIndexOf(':'); + Integer lineNumber = lastColonIndex == -1 ? null : Integer.valueOf(name.substring(lastColonIndex + 1)); + + int atIndex = name.indexOf(" at "); + String functionName = atIndex == -1 ? name : name.substring(0, atIndex); + + Issue issue = issuable.newIssueBuilder() + .ruleKey(RuleKey.of(LizardRulesDefinition.REPOSITORY_KEY, LizardRulesDefinition.FUNCTION_CYCLOMATIC_COMPLEXITY_RULE_KEY)) + .message(String.format("The Cyclomatic Complexity of this function \"%s\" is %d which is greater than %d authorized.", functionName, complexity, threshold)) + .line(lineNumber) + .effortToFix((double) (complexity - threshold)) + .build(); + + issuable.addIssue(issue); + } + } + /** * @param complexMean average complexity per function in a file * @param complexityInFunctions Entire complexity in functions * @param builder Builder ready to build FUNCTION_COMPLEXITY_DISTRIBUTION * @return list of Measures containing FUNCTION_COMPLEXITY_DISTRIBUTION, FUNCTION_COMPLEXITY and COMPLEXITY_IN_FUNCTIONS */ - public List buildFuncionMeasuresList(double complexMean, int complexityInFunctions, + public List buildFunctionMeasuresList(double complexMean, int complexityInFunctions, RangeDistributionBuilder builder) { List list = new ArrayList<>(); list.add(new Measure(CoreMetrics.FUNCTION_COMPLEXITY, complexMean)); diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardRulesDefinition.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardRulesDefinition.java new file mode 100644 index 00000000..732eaaaa --- /dev/null +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardRulesDefinition.java @@ -0,0 +1,84 @@ +/* + * SonarQube Objective-C (Community) Plugin + * Copyright (C) 2012-2016 OCTO Technology, Backelite, and contributors + * mailto:sonarqube@googlegroups.com + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 3 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the Free Software Foundation, + * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ +package org.sonar.plugins.objectivec.lizard; + +import org.sonar.api.rule.Severity; +import org.sonar.api.server.rule.RuleParamType; +import org.sonar.api.server.rule.RulesDefinition; +import org.sonar.plugins.objectivec.api.ObjectiveC; + +public final class LizardRulesDefinition implements RulesDefinition { + public static final String REPOSITORY_KEY = "lizard"; + public static final String REPOSITORY_NAME = "Lizard"; + + private static final String THRESHOLD = "Threshold"; + + public static final String FILE_CYCLOMATIC_COMPLEXITY_RULE_KEY = "FileCyclomaticComplexity"; + public static final String FILE_CYCLOMATIC_COMPLEXITY_PARAM_KEY = THRESHOLD; + + public static final String FUNCTION_CYCLOMATIC_COMPLEXITY_RULE_KEY = "FunctionCyclomaticComplexity"; + public static final String FUNCTION_CYCLOMATIC_COMPLEXITY_PARAM_KEY = THRESHOLD; + + @Override + public void define(Context context) { + NewRepository repository = context + .createRepository(REPOSITORY_KEY, ObjectiveC.KEY) + .setName(REPOSITORY_NAME); + + NewRule fileCyclomaticComplexityRule = repository + .createRule(FILE_CYCLOMATIC_COMPLEXITY_RULE_KEY) + .setName("Files should not be too complex") + .setHtmlDescription("Most of the time, a very complex file breaks the Single Responsibility " + + "Principle and should be re-factored into several different files.") + .setTags("brain-overload") + .setSeverity(Severity.MAJOR); + fileCyclomaticComplexityRule + .setDebtSubCharacteristic(SubCharacteristics.UNIT_TESTABILITY) + .setDebtRemediationFunction( + fileCyclomaticComplexityRule.debtRemediationFunctions().linearWithOffset("1min", "30min")) + .setEffortToFixDescription("per complexity point above the threshold"); + fileCyclomaticComplexityRule + .createParam(FILE_CYCLOMATIC_COMPLEXITY_PARAM_KEY) + .setDefaultValue("80") + .setType(RuleParamType.INTEGER) + .setDescription("Maximum complexity allowed."); + + NewRule functionCyclomaticComplexityRule = repository + .createRule(FUNCTION_CYCLOMATIC_COMPLEXITY_RULE_KEY) + .setName("Functions should not be too complex") + .setHtmlDescription("The cyclomatic complexity of functions should not exceed a defined threshold. " + + "Complex code can perform poorly and will in any case be difficult to understand and " + + "therefore to maintain.") + .setTags("brain-overload") + .setSeverity(Severity.MAJOR); + functionCyclomaticComplexityRule + .setDebtSubCharacteristic(SubCharacteristics.UNIT_TESTABILITY) + .setDebtRemediationFunction( + functionCyclomaticComplexityRule.debtRemediationFunctions().linearWithOffset("1min", "10min")) + .setEffortToFixDescription("per complexity point above the threshold"); + functionCyclomaticComplexityRule + .createParam(FUNCTION_CYCLOMATIC_COMPLEXITY_PARAM_KEY) + .setDefaultValue("10") + .setType(RuleParamType.INTEGER) + .setDescription("Maximum complexity allowed."); + + repository.done(); + } +} diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java index d2be66d4..b6a1de2b 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/lizard/LizardSensor.java @@ -26,8 +26,10 @@ import org.sonar.api.batch.SensorContext; import org.sonar.api.batch.fs.FileSystem; import org.sonar.api.batch.fs.InputFile; +import org.sonar.api.component.ResourcePerspectives; import org.sonar.api.config.Settings; import org.sonar.api.measures.Measure; +import org.sonar.api.profiles.RulesProfile; import org.sonar.api.resources.Project; import org.sonar.api.resources.Resource; import org.sonar.api.scan.filesystem.PathResolver; @@ -51,11 +53,16 @@ public final class LizardSensor implements Sensor { private final FileSystem fileSystem; private final PathResolver pathResolver; + private final ResourcePerspectives resourcePerspectives; + private final RulesProfile rulesProfile; private final Settings settings; - public LizardSensor(final FileSystem fileSystem, final PathResolver pathResolver, final Settings settings) { + public LizardSensor(final FileSystem fileSystem, final PathResolver pathResolver, + final ResourcePerspectives resourcePerspectives, final RulesProfile rulesProfile, final Settings settings) { this.fileSystem = fileSystem; this.pathResolver = pathResolver; + this.resourcePerspectives = resourcePerspectives; + this.rulesProfile = rulesProfile; this.settings = settings; } @@ -76,7 +83,8 @@ public void analyse(Project project, SensorContext context) { } LOGGER.info("parsing {}", report); - Map> measures = LizardReportParser.parseReport(report); + Map> measures = LizardReportParser.parseReport(fileSystem, resourcePerspectives, + rulesProfile, context, report); if (measures == null) { return; diff --git a/sonar-objective-c-plugin/src/test/java/org/sonar/plugins/objectivec/lizard/LizardReportParserTest.java b/sonar-objective-c-plugin/src/test/java/org/sonar/plugins/objectivec/lizard/LizardReportParserTest.java index c1c0e67a..a8707d62 100644 --- a/sonar-objective-c-plugin/src/test/java/org/sonar/plugins/objectivec/lizard/LizardReportParserTest.java +++ b/sonar-objective-c-plugin/src/test/java/org/sonar/plugins/objectivec/lizard/LizardReportParserTest.java @@ -23,8 +23,13 @@ import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; +import org.mockito.Mockito; +import org.sonar.api.batch.SensorContext; +import org.sonar.api.batch.fs.FileSystem; +import org.sonar.api.component.ResourcePerspectives; import org.sonar.api.measures.CoreMetrics; import org.sonar.api.measures.Measure; +import org.sonar.api.profiles.RulesProfile; import java.io.BufferedWriter; import java.io.File; @@ -34,6 +39,7 @@ import java.util.Map; import static org.junit.Assert.*; +import static org.mockito.Mockito.mock; /** * @author Andres Gil Herrera @@ -72,9 +78,9 @@ public File createCorrectFile() throws IOException { out.write(""); out.write("3205"); //average and close funciton measure - out.write(""); - out.write(""); - out.write(""); + out.write(""); + out.write(""); + out.write(""); //open file measure and add the labels out.write(""); //items for file @@ -83,9 +89,9 @@ public File createCorrectFile() throws IOException { out.write(""); out.write("286862"); //add averages - out.write(""); + out.write(""); //add sum - out.write(""); + out.write(""); //close measures and root object out.write(""); @@ -113,9 +119,9 @@ public File createIncorrectFile() throws IOException { out.write(""); out.write("3205"); //average and close funciton measure - out.write(""); - out.write(""); - out.write(""); + out.write(""); + out.write(""); + out.write(""); //open file measure and add the labels out.write(""); //items for file 3th value tag has no closing tag @@ -124,9 +130,9 @@ public File createIncorrectFile() throws IOException { out.write(""); out.write("286862"); //add averages - out.write(""); + out.write(""); //add sum - out.write(""); + out.write(""); //close measures and root object no close tag for measure out.write(""); @@ -142,7 +148,13 @@ public File createIncorrectFile() throws IOException { public void parseReportShouldReturnMapWhenXMLFileIsCorrect() { assertNotNull("correct file is null", correctFile); - Map> report = LizardReportParser.parseReport(correctFile); + FileSystem fileSystem = mock(FileSystem.class); + ResourcePerspectives resourcePerspectives = mock(ResourcePerspectives.class); + RulesProfile rulesProfile = mock(RulesProfile.class); + SensorContext sensorContext = mock(SensorContext.class); + + Map> report = LizardReportParser.parseReport(fileSystem, resourcePerspectives, + rulesProfile, sensorContext, correctFile); assertNotNull("report is null", report); @@ -194,7 +206,13 @@ public void parseReportShouldReturnMapWhenXMLFileIsCorrect() { public void parseReportShouldReturnNullWhenXMLFileIsIncorrect() { assertNotNull("correct file is null", incorrectFile); - Map> report = LizardReportParser.parseReport(incorrectFile); + FileSystem fileSystem = mock(FileSystem.class); + ResourcePerspectives resourcePerspectives = mock(ResourcePerspectives.class); + RulesProfile rulesProfile = mock(RulesProfile.class); + SensorContext sensorContext = mock(SensorContext.class); + + Map> report = LizardReportParser.parseReport(fileSystem, resourcePerspectives, + rulesProfile, sensorContext, incorrectFile); assertNull("report is not null", report); } From ccfb4a93e0338151336097e230da7f9b49f0caea Mon Sep 17 00:00:00 2001 From: Matthew DeTullio Date: Tue, 15 Mar 2016 17:24:28 -0400 Subject: [PATCH 41/42] Add AFNetworking project for ITs. https://github.com/AFNetworking/AFNetworking/tree/32547b02c986d82f4a2d76327c0107afde099719 --- .../projects/AFNetworking/.cocoadocs.yml | 7 + its/plugin/projects/AFNetworking/.gitignore | 29 + .../AFNetworking/AFNetworking.podspec | 79 + .../AFNetworking.xcodeproj/project.pbxproj | 1512 +++++++++++++ .../xcschemes/AFNetworking OS X.xcscheme | 105 + .../xcschemes/AFNetworking iOS.xcscheme | 119 + .../xcschemes/AFNetworking tvOS.xcscheme | 104 + .../xcschemes/AFNetworking watchOS.xcscheme | 80 + .../AFNetworking/AFHTTPSessionManager.h | 295 +++ .../AFNetworking/AFHTTPSessionManager.m | 361 +++ .../AFNetworkReachabilityManager.h | 206 ++ .../AFNetworkReachabilityManager.m | 263 +++ .../AFNetworking/AFNetworking/AFNetworking.h | 41 + .../AFNetworking/AFSecurityPolicy.h | 154 ++ .../AFNetworking/AFSecurityPolicy.m | 353 +++ .../AFNetworking/AFURLRequestSerialization.h | 479 ++++ .../AFNetworking/AFURLRequestSerialization.m | 1376 ++++++++++++ .../AFNetworking/AFURLResponseSerialization.h | 311 +++ .../AFNetworking/AFURLResponseSerialization.m | 803 +++++++ .../AFNetworking/AFURLSessionManager.h | 499 +++++ .../AFNetworking/AFURLSessionManager.m | 1244 ++++++++++ its/plugin/projects/AFNetworking/CHANGELOG.md | 1996 +++++++++++++++++ .../projects/AFNetworking/CONTRIBUTING.md | 96 + .../AFNetworking/Framework/AFNetworking.h | 66 + .../AFNetworking/Framework/Info.plist | 26 + .../AFNetworking/Framework/module.modulemap | 5 + its/plugin/projects/AFNetworking/LICENSE | 19 + its/plugin/projects/AFNetworking/README.md | 320 +++ .../projects/AFNetworking/Tests/Info.plist | 22 + .../ADN.net/ADNNetServerTrustChain/adn_0.cer | Bin 0 -> 1321 bytes .../ADN.net/ADNNetServerTrustChain/adn_1.cer | Bin 0 -> 1628 bytes .../ADN.net/ADNNetServerTrustChain/adn_2.cer | Bin 0 -> 969 bytes ...ifax_Secure_Certificate_Authority_Root.cer | Bin 0 -> 804 bytes .../Google.com/GeoTrust_Global_CA-cross.cer | Bin 0 -> 897 bytes .../Google.com/GeoTrust_Global_CA_Root.cer | Bin 0 -> 856 bytes .../googlecom_0.cer | Bin 0 -> 1965 bytes .../googlecom_1.cer | Bin 0 -> 1012 bytes .../googlecom_0.cer | Bin 0 -> 1965 bytes .../googlecom_1.cer | Bin 0 -> 1012 bytes .../googlecom_2.cer | Bin 0 -> 897 bytes .../Google.com/GoogleInternetAuthorityG2.cer | Bin 0 -> 1012 bytes .../Tests/Resources/Google.com/google.com.cer | Bin 0 -> 1965 bytes .../HTTPBin.org/AddTrust_External_CA_Root.cer | Bin 0 -> 1082 bytes .../COMODO_RSA_Certification_Authority.cer | Bin 0 -> 1400 bytes ...RSA_Domain_Validation_Secure_Server_CA.cer | Bin 0 -> 1548 bytes .../HTTPBinOrgServerTrustChain/httpbin_0.cer | Bin 0 -> 1363 bytes .../HTTPBinOrgServerTrustChain/httpbin_1.cer | Bin 0 -> 1548 bytes .../HTTPBinOrgServerTrustChain/httpbin_2.cer | Bin 0 -> 1400 bytes .../HTTPBinOrgServerTrustChain/httpbin_3.cer | Bin 0 -> 1082 bytes .../HTTPBin.org/httpbinorg_01192017.cer | Bin 0 -> 1363 bytes .../Tests/Resources/SelfSigned/AltName.cer | Bin 0 -> 766 bytes .../Tests/Resources/SelfSigned/NoDomains.cer | Bin 0 -> 747 bytes .../Tests/Resources/SelfSigned/foobar.com.cer | Bin 0 -> 747 bytes .../AFNetworking/Tests/Resources/logo.png | Bin 0 -> 14795 bytes .../AFNetworking/Tests/Tests-Prefix.pch | 9 + .../Tests/AFAutoPurgingImageCacheTests.m | 233 ++ .../Tests/AFCompoundResponseSerializerTests.m | 89 + .../Tests/AFHTTPRequestSerializationTests.m | 214 ++ .../Tests/AFHTTPResponseSerializationTests.m | 89 + .../Tests/Tests/AFHTTPSessionManagerTests.m | 538 +++++ .../Tests/Tests/AFImageDownloaderTests.m | 428 ++++ .../Tests/Tests/AFJSONSerializationTests.m | 171 ++ .../Tests/AFNetworkActivityManagerTests.m | 181 ++ .../Tests/AFNetworkReachabilityManagerTests.m | 124 + .../AFPropertyListResponseSerializerTests.m | 66 + .../Tests/Tests/AFSecurityPolicyTests.m | 654 ++++++ .../AFNetworking/Tests/Tests/AFTestCase.h | 33 + .../AFNetworking/Tests/Tests/AFTestCase.m | 47 + .../Tests/AFUIActivityIndicatorViewTests.m | 111 + .../Tests/Tests/AFUIButtonTests.m | 115 + .../Tests/Tests/AFUIImageViewTests.m | 155 ++ .../Tests/Tests/AFUIRefreshControlTests.m | 110 + .../Tests/Tests/AFUIWebViewTests.m | 85 + .../Tests/Tests/AFURLSessionManagerTests.m | 473 ++++ .../AFAutoPurgingImageCache.h | 149 ++ .../AFAutoPurgingImageCache.m | 201 ++ .../UIKit+AFNetworking/AFImageDownloader.h | 157 ++ .../UIKit+AFNetworking/AFImageDownloader.m | 382 ++++ .../AFNetworkActivityIndicatorManager.h | 103 + .../AFNetworkActivityIndicatorManager.m | 261 +++ .../UIActivityIndicatorView+AFNetworking.h | 48 + .../UIActivityIndicatorView+AFNetworking.m | 124 + .../UIButton+AFNetworking.h | 175 ++ .../UIButton+AFNetworking.m | 305 +++ .../UIKit+AFNetworking/UIImage+AFNetworking.h | 35 + .../UIImageView+AFNetworking.h | 109 + .../UIImageView+AFNetworking.m | 161 ++ .../UIKit+AFNetworking/UIKit+AFNetworking.h | 42 + .../UIProgressView+AFNetworking.h | 64 + .../UIProgressView+AFNetworking.m | 118 + .../UIRefreshControl+AFNetworking.h | 53 + .../UIRefreshControl+AFNetworking.m | 122 + .../UIWebView+AFNetworking.h | 80 + .../UIWebView+AFNetworking.m | 162 ++ .../projects/AFNetworking/fastlane/.env | 10 + .../AFNetworking/fastlane/.env.default | 15 + .../AFNetworking/fastlane/.env.deploy | 14 + .../AFNetworking/fastlane/.env.ios81_xcode7 | 3 + .../projects/AFNetworking/fastlane/.env.ios83 | 2 + .../projects/AFNetworking/fastlane/.env.ios84 | 2 + .../AFNetworking/fastlane/.env.ios90_xcode7 | 3 + .../AFNetworking/fastlane/.env.ios91_xcode71 | 3 + .../projects/AFNetworking/fastlane/.env.ios92 | 2 + .../AFNetworking/fastlane/.env.ios93_xcode73 | 3 + .../projects/AFNetworking/fastlane/.env.osx | 6 + .../AFNetworking/fastlane/.env.tvos90_xcode71 | 6 + .../AFNetworking/fastlane/.env.tvos91 | 6 + .../projects/AFNetworking/fastlane/Fastfile | 337 +++ .../projects/AFNetworking/fastlane/README.md | 196 ++ .../actions/af_build_carthage_frameworks.rb | 64 + .../actions/af_create_github_release.rb | 156 ++ .../actions/af_edit_github_release.rb | 161 ++ .../af_generate_github_milestone_changelog.rb | 225 ++ .../actions/af_get_github_milestone.rb | 129 ++ .../actions/af_insert_text_into_file.rb | 80 + .../fastlane/actions/af_pod_spec_lint.rb | 90 + .../actions/af_push_git_tags_to_remote.rb | 47 + .../actions/af_update_github_milestone.rb | 138 ++ .../af_upload_asset_for_github_release.rb | 134 ++ 119 files changed, 19578 insertions(+) create mode 100644 its/plugin/projects/AFNetworking/.cocoadocs.yml create mode 100644 its/plugin/projects/AFNetworking/.gitignore create mode 100644 its/plugin/projects/AFNetworking/AFNetworking.podspec create mode 100644 its/plugin/projects/AFNetworking/AFNetworking.xcodeproj/project.pbxproj create mode 100644 its/plugin/projects/AFNetworking/AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking OS X.xcscheme create mode 100644 its/plugin/projects/AFNetworking/AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking iOS.xcscheme create mode 100644 its/plugin/projects/AFNetworking/AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking tvOS.xcscheme create mode 100644 its/plugin/projects/AFNetworking/AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking watchOS.xcscheme create mode 100644 its/plugin/projects/AFNetworking/AFNetworking/AFHTTPSessionManager.h create mode 100644 its/plugin/projects/AFNetworking/AFNetworking/AFHTTPSessionManager.m create mode 100644 its/plugin/projects/AFNetworking/AFNetworking/AFNetworkReachabilityManager.h create mode 100644 its/plugin/projects/AFNetworking/AFNetworking/AFNetworkReachabilityManager.m create mode 100644 its/plugin/projects/AFNetworking/AFNetworking/AFNetworking.h create mode 100644 its/plugin/projects/AFNetworking/AFNetworking/AFSecurityPolicy.h create mode 100644 its/plugin/projects/AFNetworking/AFNetworking/AFSecurityPolicy.m create mode 100644 its/plugin/projects/AFNetworking/AFNetworking/AFURLRequestSerialization.h create mode 100644 its/plugin/projects/AFNetworking/AFNetworking/AFURLRequestSerialization.m create mode 100644 its/plugin/projects/AFNetworking/AFNetworking/AFURLResponseSerialization.h create mode 100755 its/plugin/projects/AFNetworking/AFNetworking/AFURLResponseSerialization.m create mode 100644 its/plugin/projects/AFNetworking/AFNetworking/AFURLSessionManager.h create mode 100644 its/plugin/projects/AFNetworking/AFNetworking/AFURLSessionManager.m create mode 100644 its/plugin/projects/AFNetworking/CHANGELOG.md create mode 100644 its/plugin/projects/AFNetworking/CONTRIBUTING.md create mode 100644 its/plugin/projects/AFNetworking/Framework/AFNetworking.h create mode 100644 its/plugin/projects/AFNetworking/Framework/Info.plist create mode 100644 its/plugin/projects/AFNetworking/Framework/module.modulemap create mode 100644 its/plugin/projects/AFNetworking/LICENSE create mode 100644 its/plugin/projects/AFNetworking/README.md create mode 100644 its/plugin/projects/AFNetworking/Tests/Info.plist create mode 100644 its/plugin/projects/AFNetworking/Tests/Resources/ADN.net/ADNNetServerTrustChain/adn_0.cer create mode 100644 its/plugin/projects/AFNetworking/Tests/Resources/ADN.net/ADNNetServerTrustChain/adn_1.cer create mode 100644 its/plugin/projects/AFNetworking/Tests/Resources/ADN.net/ADNNetServerTrustChain/adn_2.cer create mode 100644 its/plugin/projects/AFNetworking/Tests/Resources/Google.com/Equifax_Secure_Certificate_Authority_Root.cer create mode 100644 its/plugin/projects/AFNetworking/Tests/Resources/Google.com/GeoTrust_Global_CA-cross.cer create mode 100644 its/plugin/projects/AFNetworking/Tests/Resources/Google.com/GeoTrust_Global_CA_Root.cer create mode 100644 its/plugin/projects/AFNetworking/Tests/Resources/Google.com/GoogleComServerTrustChainPath1/googlecom_0.cer create mode 100644 its/plugin/projects/AFNetworking/Tests/Resources/Google.com/GoogleComServerTrustChainPath1/googlecom_1.cer create mode 100644 its/plugin/projects/AFNetworking/Tests/Resources/Google.com/GoogleComServerTrustChainPath2/googlecom_0.cer create mode 100644 its/plugin/projects/AFNetworking/Tests/Resources/Google.com/GoogleComServerTrustChainPath2/googlecom_1.cer create mode 100644 its/plugin/projects/AFNetworking/Tests/Resources/Google.com/GoogleComServerTrustChainPath2/googlecom_2.cer create mode 100644 its/plugin/projects/AFNetworking/Tests/Resources/Google.com/GoogleInternetAuthorityG2.cer create mode 100644 its/plugin/projects/AFNetworking/Tests/Resources/Google.com/google.com.cer create mode 100644 its/plugin/projects/AFNetworking/Tests/Resources/HTTPBin.org/AddTrust_External_CA_Root.cer create mode 100644 its/plugin/projects/AFNetworking/Tests/Resources/HTTPBin.org/COMODO_RSA_Certification_Authority.cer create mode 100644 its/plugin/projects/AFNetworking/Tests/Resources/HTTPBin.org/COMODO_RSA_Domain_Validation_Secure_Server_CA.cer create mode 100644 its/plugin/projects/AFNetworking/Tests/Resources/HTTPBin.org/HTTPBinOrgServerTrustChain/httpbin_0.cer create mode 100644 its/plugin/projects/AFNetworking/Tests/Resources/HTTPBin.org/HTTPBinOrgServerTrustChain/httpbin_1.cer create mode 100644 its/plugin/projects/AFNetworking/Tests/Resources/HTTPBin.org/HTTPBinOrgServerTrustChain/httpbin_2.cer create mode 100644 its/plugin/projects/AFNetworking/Tests/Resources/HTTPBin.org/HTTPBinOrgServerTrustChain/httpbin_3.cer create mode 100644 its/plugin/projects/AFNetworking/Tests/Resources/HTTPBin.org/httpbinorg_01192017.cer create mode 100644 its/plugin/projects/AFNetworking/Tests/Resources/SelfSigned/AltName.cer create mode 100644 its/plugin/projects/AFNetworking/Tests/Resources/SelfSigned/NoDomains.cer create mode 100644 its/plugin/projects/AFNetworking/Tests/Resources/SelfSigned/foobar.com.cer create mode 100644 its/plugin/projects/AFNetworking/Tests/Resources/logo.png create mode 100644 its/plugin/projects/AFNetworking/Tests/Tests-Prefix.pch create mode 100644 its/plugin/projects/AFNetworking/Tests/Tests/AFAutoPurgingImageCacheTests.m create mode 100644 its/plugin/projects/AFNetworking/Tests/Tests/AFCompoundResponseSerializerTests.m create mode 100644 its/plugin/projects/AFNetworking/Tests/Tests/AFHTTPRequestSerializationTests.m create mode 100644 its/plugin/projects/AFNetworking/Tests/Tests/AFHTTPResponseSerializationTests.m create mode 100644 its/plugin/projects/AFNetworking/Tests/Tests/AFHTTPSessionManagerTests.m create mode 100644 its/plugin/projects/AFNetworking/Tests/Tests/AFImageDownloaderTests.m create mode 100644 its/plugin/projects/AFNetworking/Tests/Tests/AFJSONSerializationTests.m create mode 100644 its/plugin/projects/AFNetworking/Tests/Tests/AFNetworkActivityManagerTests.m create mode 100644 its/plugin/projects/AFNetworking/Tests/Tests/AFNetworkReachabilityManagerTests.m create mode 100644 its/plugin/projects/AFNetworking/Tests/Tests/AFPropertyListResponseSerializerTests.m create mode 100644 its/plugin/projects/AFNetworking/Tests/Tests/AFSecurityPolicyTests.m create mode 100644 its/plugin/projects/AFNetworking/Tests/Tests/AFTestCase.h create mode 100644 its/plugin/projects/AFNetworking/Tests/Tests/AFTestCase.m create mode 100644 its/plugin/projects/AFNetworking/Tests/Tests/AFUIActivityIndicatorViewTests.m create mode 100644 its/plugin/projects/AFNetworking/Tests/Tests/AFUIButtonTests.m create mode 100644 its/plugin/projects/AFNetworking/Tests/Tests/AFUIImageViewTests.m create mode 100644 its/plugin/projects/AFNetworking/Tests/Tests/AFUIRefreshControlTests.m create mode 100644 its/plugin/projects/AFNetworking/Tests/Tests/AFUIWebViewTests.m create mode 100644 its/plugin/projects/AFNetworking/Tests/Tests/AFURLSessionManagerTests.m create mode 100644 its/plugin/projects/AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.h create mode 100644 its/plugin/projects/AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.m create mode 100644 its/plugin/projects/AFNetworking/UIKit+AFNetworking/AFImageDownloader.h create mode 100644 its/plugin/projects/AFNetworking/UIKit+AFNetworking/AFImageDownloader.m create mode 100644 its/plugin/projects/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h create mode 100644 its/plugin/projects/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.m create mode 100644 its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h create mode 100644 its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.m create mode 100644 its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.h create mode 100644 its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.m create mode 100644 its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIImage+AFNetworking.h create mode 100644 its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h create mode 100644 its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.m create mode 100644 its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h create mode 100644 its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h create mode 100644 its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.m create mode 100644 its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h create mode 100644 its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.m create mode 100644 its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h create mode 100644 its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.m create mode 100644 its/plugin/projects/AFNetworking/fastlane/.env create mode 100644 its/plugin/projects/AFNetworking/fastlane/.env.default create mode 100644 its/plugin/projects/AFNetworking/fastlane/.env.deploy create mode 100644 its/plugin/projects/AFNetworking/fastlane/.env.ios81_xcode7 create mode 100644 its/plugin/projects/AFNetworking/fastlane/.env.ios83 create mode 100644 its/plugin/projects/AFNetworking/fastlane/.env.ios84 create mode 100644 its/plugin/projects/AFNetworking/fastlane/.env.ios90_xcode7 create mode 100644 its/plugin/projects/AFNetworking/fastlane/.env.ios91_xcode71 create mode 100644 its/plugin/projects/AFNetworking/fastlane/.env.ios92 create mode 100644 its/plugin/projects/AFNetworking/fastlane/.env.ios93_xcode73 create mode 100644 its/plugin/projects/AFNetworking/fastlane/.env.osx create mode 100644 its/plugin/projects/AFNetworking/fastlane/.env.tvos90_xcode71 create mode 100644 its/plugin/projects/AFNetworking/fastlane/.env.tvos91 create mode 100644 its/plugin/projects/AFNetworking/fastlane/Fastfile create mode 100644 its/plugin/projects/AFNetworking/fastlane/README.md create mode 100644 its/plugin/projects/AFNetworking/fastlane/actions/af_build_carthage_frameworks.rb create mode 100644 its/plugin/projects/AFNetworking/fastlane/actions/af_create_github_release.rb create mode 100644 its/plugin/projects/AFNetworking/fastlane/actions/af_edit_github_release.rb create mode 100644 its/plugin/projects/AFNetworking/fastlane/actions/af_generate_github_milestone_changelog.rb create mode 100644 its/plugin/projects/AFNetworking/fastlane/actions/af_get_github_milestone.rb create mode 100644 its/plugin/projects/AFNetworking/fastlane/actions/af_insert_text_into_file.rb create mode 100644 its/plugin/projects/AFNetworking/fastlane/actions/af_pod_spec_lint.rb create mode 100644 its/plugin/projects/AFNetworking/fastlane/actions/af_push_git_tags_to_remote.rb create mode 100644 its/plugin/projects/AFNetworking/fastlane/actions/af_update_github_milestone.rb create mode 100644 its/plugin/projects/AFNetworking/fastlane/actions/af_upload_asset_for_github_release.rb diff --git a/its/plugin/projects/AFNetworking/.cocoadocs.yml b/its/plugin/projects/AFNetworking/.cocoadocs.yml new file mode 100644 index 00000000..aaf16cb1 --- /dev/null +++ b/its/plugin/projects/AFNetworking/.cocoadocs.yml @@ -0,0 +1,7 @@ +highlight-color: "#F89915" +highlight-dark-color: "#E23B1B" +darker-color: "#D8A688" +darker-dark-color: "#E93D1C" +background-color: "#E9DFDB" +alt-link-color: "#E23B1B" +warning-color: "#E23B1B" diff --git a/its/plugin/projects/AFNetworking/.gitignore b/its/plugin/projects/AFNetworking/.gitignore new file mode 100644 index 00000000..ca205d04 --- /dev/null +++ b/its/plugin/projects/AFNetworking/.gitignore @@ -0,0 +1,29 @@ +# Xcode +.DS_Store +build/ +*.pbxuser +!default.pbxuser +*.mode1v3 +!default.mode1v3 +*.mode2v3 +!default.mode2v3 +*.perspectivev3 +!default.perspectivev3 +*.xcworkspace +!default.xcworkspace +xcuserdata +profile +*.moved-aside +DerivedData +.idea/ +Tests/Pods +Tests/Podfile.lock +Tests/AFNetworking Tests.xcodeproj/xcshareddata/xcschemes/ +AFNetworking.framework.zip + +# Fastlane +/fastlane/report.xml +/fastlane/.env*private* +fastlane/test-output/* + +Carthage/Build diff --git a/its/plugin/projects/AFNetworking/AFNetworking.podspec b/its/plugin/projects/AFNetworking/AFNetworking.podspec new file mode 100644 index 00000000..3241d77b --- /dev/null +++ b/its/plugin/projects/AFNetworking/AFNetworking.podspec @@ -0,0 +1,79 @@ +Pod::Spec.new do |s| + s.name = 'AFNetworking' + s.version = '3.0.4' + s.license = 'MIT' + s.summary = 'A delightful iOS and OS X networking framework.' + s.homepage = 'https://github.com/AFNetworking/AFNetworking' + s.social_media_url = 'https://twitter.com/AFNetworking' + s.authors = { 'Mattt Thompson' => 'm@mattt.me' } + s.source = { :git => 'https://github.com/AFNetworking/AFNetworking.git', :tag => s.version, :submodules => true } + s.requires_arc = true + + s.public_header_files = 'AFNetworking/AFNetworking.h' + s.source_files = 'AFNetworking/AFNetworking.h' + + pch_AF = <<-EOS +#ifndef TARGET_OS_IOS + #define TARGET_OS_IOS TARGET_OS_IPHONE +#endif + +#ifndef TARGET_OS_WATCH + #define TARGET_OS_WATCH 0 +#endif + +#ifndef TARGET_OS_TV + #define TARGET_OS_TV 0 +#endif +EOS + s.prefix_header_contents = pch_AF + + s.ios.deployment_target = '7.0' + s.osx.deployment_target = '10.9' + s.watchos.deployment_target = '2.0' + s.tvos.deployment_target = '9.0' + + s.subspec 'Serialization' do |ss| + ss.source_files = 'AFNetworking/AFURL{Request,Response}Serialization.{h,m}' + ss.public_header_files = 'AFNetworking/AFURL{Request,Response}Serialization.h' + ss.watchos.frameworks = 'MobileCoreServices', 'CoreGraphics' + ss.ios.frameworks = 'MobileCoreServices', 'CoreGraphics' + ss.osx.frameworks = 'CoreServices' + end + + s.subspec 'Security' do |ss| + ss.source_files = 'AFNetworking/AFSecurityPolicy.{h,m}' + ss.public_header_files = 'AFNetworking/AFSecurityPolicy.h' + ss.frameworks = 'Security' + end + + s.subspec 'Reachability' do |ss| + ss.ios.deployment_target = '7.0' + ss.osx.deployment_target = '10.9' + ss.tvos.deployment_target = '9.0' + + ss.source_files = 'AFNetworking/AFNetworkReachabilityManager.{h,m}' + ss.public_header_files = 'AFNetworking/AFNetworkReachabilityManager.h' + + ss.frameworks = 'SystemConfiguration' + end + + s.subspec 'NSURLSession' do |ss| + ss.dependency 'AFNetworking/Serialization' + ss.ios.dependency 'AFNetworking/Reachability' + ss.osx.dependency 'AFNetworking/Reachability' + ss.tvos.dependency 'AFNetworking/Reachability' + ss.dependency 'AFNetworking/Security' + + ss.source_files = 'AFNetworking/AF{URL,HTTP}SessionManager.{h,m}' + ss.public_header_files = 'AFNetworking/AF{URL,HTTP}SessionManager.h' + end + + s.subspec 'UIKit' do |ss| + ss.ios.deployment_target = '7.0' + ss.tvos.deployment_target = '9.0' + ss.dependency 'AFNetworking/NSURLSession' + + ss.public_header_files = 'UIKit+AFNetworking/*.h' + ss.source_files = 'UIKit+AFNetworking' + end +end diff --git a/its/plugin/projects/AFNetworking/AFNetworking.xcodeproj/project.pbxproj b/its/plugin/projects/AFNetworking/AFNetworking.xcodeproj/project.pbxproj new file mode 100644 index 00000000..337d8707 --- /dev/null +++ b/its/plugin/projects/AFNetworking/AFNetworking.xcodeproj/project.pbxproj @@ -0,0 +1,1512 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 1FE783011C5857A100A73B7C /* httpbinorg_01192017.cer in Resources */ = {isa = PBXBuildFile; fileRef = 1FE783001C58579D00A73B7C /* httpbinorg_01192017.cer */; }; + 1FE783021C5857A100A73B7C /* httpbinorg_01192017.cer in Resources */ = {isa = PBXBuildFile; fileRef = 1FE783001C58579D00A73B7C /* httpbinorg_01192017.cer */; }; + 1FE783031C5857A200A73B7C /* httpbinorg_01192017.cer in Resources */ = {isa = PBXBuildFile; fileRef = 1FE783001C58579D00A73B7C /* httpbinorg_01192017.cer */; }; + 2960BAC31C1B2F1A00BA02F0 /* AFUIButtonTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 2960BAC21C1B2F1A00BA02F0 /* AFUIButtonTests.m */; }; + 297824A31BC2D69A0041C395 /* adn_0.cer in Resources */ = {isa = PBXBuildFile; fileRef = 297824A01BC2D69A0041C395 /* adn_0.cer */; }; + 297824A41BC2D69A0041C395 /* adn_0.cer in Resources */ = {isa = PBXBuildFile; fileRef = 297824A01BC2D69A0041C395 /* adn_0.cer */; }; + 297824A51BC2D69A0041C395 /* adn_1.cer in Resources */ = {isa = PBXBuildFile; fileRef = 297824A11BC2D69A0041C395 /* adn_1.cer */; }; + 297824A61BC2D69A0041C395 /* adn_1.cer in Resources */ = {isa = PBXBuildFile; fileRef = 297824A11BC2D69A0041C395 /* adn_1.cer */; }; + 297824A71BC2D69A0041C395 /* adn_2.cer in Resources */ = {isa = PBXBuildFile; fileRef = 297824A21BC2D69A0041C395 /* adn_2.cer */; }; + 297824A81BC2D69A0041C395 /* adn_2.cer in Resources */ = {isa = PBXBuildFile; fileRef = 297824A21BC2D69A0041C395 /* adn_2.cer */; }; + 297824AA1BC2DAD80041C395 /* AFAutoPurgingImageCacheTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C801BC2C88F00FD3B3E /* AFAutoPurgingImageCacheTests.m */; }; + 297824AB1BC2DB060041C395 /* AFNetworking.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 299522391BBF104D00859F49 /* AFNetworking.framework */; }; + 297824AC1BC2DB450041C395 /* AFImageDownloaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C841BC2C88F00FD3B3E /* AFImageDownloaderTests.m */; }; + 297824AD1BC2DBA40041C395 /* AFNetworkActivityManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C861BC2C88F00FD3B3E /* AFNetworkActivityManagerTests.m */; }; + 297824AE1BC2DBD80041C395 /* AFUIActivityIndicatorViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C8C1BC2C88F00FD3B3E /* AFUIActivityIndicatorViewTests.m */; }; + 297824AF1BC2DBEF0041C395 /* AFUIRefreshControlTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C8E1BC2C88F00FD3B3E /* AFUIRefreshControlTests.m */; }; + 297824B01BC2DC2D0041C395 /* AFUIImageViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C8D1BC2C88F00FD3B3E /* AFUIImageViewTests.m */; }; + 2987B0AF1BC408A200179A4C /* AFNetworking.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2987B0A51BC408A200179A4C /* AFNetworking.framework */; }; + 2987B0BC1BC408D900179A4C /* AFHTTPSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 299522471BBF125A00859F49 /* AFHTTPSessionManager.m */; }; + 2987B0BD1BC408D900179A4C /* AFNetworkReachabilityManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 2995224A1BBF125A00859F49 /* AFNetworkReachabilityManager.m */; }; + 2987B0BE1BC408D900179A4C /* AFSecurityPolicy.m in Sources */ = {isa = PBXBuildFile; fileRef = 2995224C1BBF125A00859F49 /* AFSecurityPolicy.m */; }; + 2987B0BF1BC408D900179A4C /* AFURLRequestSerialization.m in Sources */ = {isa = PBXBuildFile; fileRef = 2995224E1BBF125A00859F49 /* AFURLRequestSerialization.m */; }; + 2987B0C01BC408D900179A4C /* AFURLResponseSerialization.m in Sources */ = {isa = PBXBuildFile; fileRef = 299522501BBF125A00859F49 /* AFURLResponseSerialization.m */; }; + 2987B0C11BC408D900179A4C /* AFURLSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 299522521BBF125A00859F49 /* AFURLSessionManager.m */; }; + 2987B0C21BC408F900179A4C /* AFAutoPurgingImageCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 299522871BBF13C700859F49 /* AFAutoPurgingImageCache.m */; }; + 2987B0C31BC408F900179A4C /* AFImageDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 299522891BBF13C700859F49 /* AFImageDownloader.m */; }; + 2987B0C41BC408F900179A4C /* UIActivityIndicatorView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 2995228D1BBF13C700859F49 /* UIActivityIndicatorView+AFNetworking.m */; }; + 2987B0C51BC408F900179A4C /* UIButton+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 299522911BBF13C700859F49 /* UIButton+AFNetworking.m */; }; + 2987B0C61BC408F900179A4C /* UIImageView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 299522941BBF13C700859F49 /* UIImageView+AFNetworking.m */; }; + 2987B0C71BC408F900179A4C /* UIProgressView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 299522971BBF13C700859F49 /* UIProgressView+AFNetworking.m */; }; + 2987B0CA1BC40A7600179A4C /* AFHTTPRequestSerializationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C811BC2C88F00FD3B3E /* AFHTTPRequestSerializationTests.m */; }; + 2987B0CB1BC40A7600179A4C /* AFHTTPResponseSerializationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C821BC2C88F00FD3B3E /* AFHTTPResponseSerializationTests.m */; }; + 2987B0CC1BC40A7600179A4C /* AFHTTPSessionManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C831BC2C88F00FD3B3E /* AFHTTPSessionManagerTests.m */; }; + 2987B0CD1BC40A7600179A4C /* AFJSONSerializationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C851BC2C88F00FD3B3E /* AFJSONSerializationTests.m */; }; + 2987B0CE1BC40A7600179A4C /* AFNetworkReachabilityManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C871BC2C88F00FD3B3E /* AFNetworkReachabilityManagerTests.m */; }; + 2987B0CF1BC40A7600179A4C /* AFPropertyListResponseSerializerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C881BC2C88F00FD3B3E /* AFPropertyListResponseSerializerTests.m */; }; + 2987B0D01BC40A7600179A4C /* AFSecurityPolicyTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C891BC2C88F00FD3B3E /* AFSecurityPolicyTests.m */; }; + 2987B0D11BC40A7600179A4C /* AFURLSessionManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C8F1BC2C88F00FD3B3E /* AFURLSessionManagerTests.m */; }; + 2987B0D21BC40AD800179A4C /* AFTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C8B1BC2C88F00FD3B3E /* AFTestCase.m */; }; + 2987B0D31BC40AE900179A4C /* adn_0.cer in Resources */ = {isa = PBXBuildFile; fileRef = 297824A01BC2D69A0041C395 /* adn_0.cer */; }; + 2987B0D41BC40AE900179A4C /* adn_1.cer in Resources */ = {isa = PBXBuildFile; fileRef = 297824A11BC2D69A0041C395 /* adn_1.cer */; }; + 2987B0D51BC40AE900179A4C /* adn_2.cer in Resources */ = {isa = PBXBuildFile; fileRef = 297824A21BC2D69A0041C395 /* adn_2.cer */; }; + 2987B0D61BC40AEC00179A4C /* ADNNetServerTrustChain in Resources */ = {isa = PBXBuildFile; fileRef = 298D7CDF1BC2CB5A00FD3B3E /* ADNNetServerTrustChain */; }; + 2987B0D71BC40AF000179A4C /* HTTPBinOrgServerTrustChain in Resources */ = {isa = PBXBuildFile; fileRef = 298D7CE21BC2CB7C00FD3B3E /* HTTPBinOrgServerTrustChain */; }; + 2987B0D81BC40AF300179A4C /* AddTrust_External_CA_Root.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C6E1BC2C88F00FD3B3E /* AddTrust_External_CA_Root.cer */; }; + 2987B0D91BC40AF300179A4C /* COMODO_RSA_Certification_Authority.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C6F1BC2C88F00FD3B3E /* COMODO_RSA_Certification_Authority.cer */; }; + 2987B0DA1BC40AF300179A4C /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C701BC2C88F00FD3B3E /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer */; }; + 2987B0DC1BC40AF600179A4C /* logo.png in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C771BC2C88F00FD3B3E /* logo.png */; }; + 2987B0DD1BC40AFB00179A4C /* AltName.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C791BC2C88F00FD3B3E /* AltName.cer */; }; + 2987B0DE1BC40AFB00179A4C /* foobar.com.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C7A1BC2C88F00FD3B3E /* foobar.com.cer */; }; + 2987B0DF1BC40AFB00179A4C /* NoDomains.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C7B1BC2C88F00FD3B3E /* NoDomains.cer */; }; + 2987B0E01BC40B0900179A4C /* AFAutoPurgingImageCacheTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C801BC2C88F00FD3B3E /* AFAutoPurgingImageCacheTests.m */; }; + 2987B0E11BC40B0900179A4C /* AFImageDownloaderTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C841BC2C88F00FD3B3E /* AFImageDownloaderTests.m */; }; + 2987B0E31BC40B0900179A4C /* AFUIActivityIndicatorViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C8C1BC2C88F00FD3B3E /* AFUIActivityIndicatorViewTests.m */; }; + 2987B0E41BC40B0900179A4C /* AFUIImageViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C8D1BC2C88F00FD3B3E /* AFUIImageViewTests.m */; }; + 298D7C4F1BC2C7B200FD3B3E /* AFNetworking.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 299522771BBF136400859F49 /* AFNetworking.framework */; }; + 298D7C961BC2C94400FD3B3E /* AFTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C8B1BC2C88F00FD3B3E /* AFTestCase.m */; }; + 298D7C971BC2C94500FD3B3E /* AFTestCase.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C8B1BC2C88F00FD3B3E /* AFTestCase.m */; }; + 298D7C981BC2CA2500FD3B3E /* AFURLSessionManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C8F1BC2C88F00FD3B3E /* AFURLSessionManagerTests.m */; }; + 298D7C991BC2CA2600FD3B3E /* AFURLSessionManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C8F1BC2C88F00FD3B3E /* AFURLSessionManagerTests.m */; }; + 298D7CB11BC2CA6E00FD3B3E /* AFHTTPRequestSerializationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C811BC2C88F00FD3B3E /* AFHTTPRequestSerializationTests.m */; }; + 298D7CB21BC2CA6E00FD3B3E /* AFHTTPRequestSerializationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C811BC2C88F00FD3B3E /* AFHTTPRequestSerializationTests.m */; }; + 298D7CB91BC2CA9800FD3B3E /* logo.png in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C771BC2C88F00FD3B3E /* logo.png */; }; + 298D7CBA1BC2CA9800FD3B3E /* logo.png in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C771BC2C88F00FD3B3E /* logo.png */; }; + 298D7CBB1BC2CA9C00FD3B3E /* AltName.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C791BC2C88F00FD3B3E /* AltName.cer */; }; + 298D7CBC1BC2CA9C00FD3B3E /* foobar.com.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C7A1BC2C88F00FD3B3E /* foobar.com.cer */; }; + 298D7CBD1BC2CA9C00FD3B3E /* NoDomains.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C7B1BC2C88F00FD3B3E /* NoDomains.cer */; }; + 298D7CBE1BC2CA9D00FD3B3E /* AltName.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C791BC2C88F00FD3B3E /* AltName.cer */; }; + 298D7CBF1BC2CA9D00FD3B3E /* foobar.com.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C7A1BC2C88F00FD3B3E /* foobar.com.cer */; }; + 298D7CC01BC2CA9D00FD3B3E /* NoDomains.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C7B1BC2C88F00FD3B3E /* NoDomains.cer */; }; + 298D7CC11BC2CAA100FD3B3E /* AddTrust_External_CA_Root.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C6E1BC2C88F00FD3B3E /* AddTrust_External_CA_Root.cer */; }; + 298D7CC21BC2CAA100FD3B3E /* COMODO_RSA_Certification_Authority.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C6F1BC2C88F00FD3B3E /* COMODO_RSA_Certification_Authority.cer */; }; + 298D7CC31BC2CAA100FD3B3E /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C701BC2C88F00FD3B3E /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer */; }; + 298D7CC51BC2CAA200FD3B3E /* AddTrust_External_CA_Root.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C6E1BC2C88F00FD3B3E /* AddTrust_External_CA_Root.cer */; }; + 298D7CC61BC2CAA200FD3B3E /* COMODO_RSA_Certification_Authority.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C6F1BC2C88F00FD3B3E /* COMODO_RSA_Certification_Authority.cer */; }; + 298D7CC71BC2CAA200FD3B3E /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer in Resources */ = {isa = PBXBuildFile; fileRef = 298D7C701BC2C88F00FD3B3E /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer */; }; + 298D7CD31BC2CAE800FD3B3E /* AFHTTPResponseSerializationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C821BC2C88F00FD3B3E /* AFHTTPResponseSerializationTests.m */; }; + 298D7CD41BC2CAE900FD3B3E /* AFHTTPResponseSerializationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C821BC2C88F00FD3B3E /* AFHTTPResponseSerializationTests.m */; }; + 298D7CD51BC2CAEC00FD3B3E /* AFHTTPSessionManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C831BC2C88F00FD3B3E /* AFHTTPSessionManagerTests.m */; }; + 298D7CD61BC2CAED00FD3B3E /* AFHTTPSessionManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C831BC2C88F00FD3B3E /* AFHTTPSessionManagerTests.m */; }; + 298D7CD71BC2CAEF00FD3B3E /* AFJSONSerializationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C851BC2C88F00FD3B3E /* AFJSONSerializationTests.m */; }; + 298D7CD81BC2CAF000FD3B3E /* AFJSONSerializationTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C851BC2C88F00FD3B3E /* AFJSONSerializationTests.m */; }; + 298D7CD91BC2CAF200FD3B3E /* AFNetworkReachabilityManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C871BC2C88F00FD3B3E /* AFNetworkReachabilityManagerTests.m */; }; + 298D7CDA1BC2CAF300FD3B3E /* AFNetworkReachabilityManagerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C871BC2C88F00FD3B3E /* AFNetworkReachabilityManagerTests.m */; }; + 298D7CDB1BC2CAF500FD3B3E /* AFPropertyListResponseSerializerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C881BC2C88F00FD3B3E /* AFPropertyListResponseSerializerTests.m */; }; + 298D7CDC1BC2CAF500FD3B3E /* AFPropertyListResponseSerializerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C881BC2C88F00FD3B3E /* AFPropertyListResponseSerializerTests.m */; }; + 298D7CDD1BC2CAF700FD3B3E /* AFSecurityPolicyTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C891BC2C88F00FD3B3E /* AFSecurityPolicyTests.m */; }; + 298D7CDE1BC2CAF800FD3B3E /* AFSecurityPolicyTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 298D7C891BC2C88F00FD3B3E /* AFSecurityPolicyTests.m */; }; + 298D7CE01BC2CB5A00FD3B3E /* ADNNetServerTrustChain in Resources */ = {isa = PBXBuildFile; fileRef = 298D7CDF1BC2CB5A00FD3B3E /* ADNNetServerTrustChain */; }; + 298D7CE11BC2CB5A00FD3B3E /* ADNNetServerTrustChain in Resources */ = {isa = PBXBuildFile; fileRef = 298D7CDF1BC2CB5A00FD3B3E /* ADNNetServerTrustChain */; }; + 298D7CE31BC2CB7C00FD3B3E /* HTTPBinOrgServerTrustChain in Resources */ = {isa = PBXBuildFile; fileRef = 298D7CE21BC2CB7C00FD3B3E /* HTTPBinOrgServerTrustChain */; }; + 298D7CE41BC2CB7C00FD3B3E /* HTTPBinOrgServerTrustChain in Resources */ = {isa = PBXBuildFile; fileRef = 298D7CE21BC2CB7C00FD3B3E /* HTTPBinOrgServerTrustChain */; }; + 2995223D1BBF104D00859F49 /* AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 2995223C1BBF104D00859F49 /* AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 299522531BBF125A00859F49 /* AFHTTPSessionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522461BBF125A00859F49 /* AFHTTPSessionManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 299522541BBF125A00859F49 /* AFHTTPSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 299522471BBF125A00859F49 /* AFHTTPSessionManager.m */; }; + 299522561BBF125A00859F49 /* AFNetworkReachabilityManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522491BBF125A00859F49 /* AFNetworkReachabilityManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 299522571BBF125A00859F49 /* AFNetworkReachabilityManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 2995224A1BBF125A00859F49 /* AFNetworkReachabilityManager.m */; }; + 299522581BBF125A00859F49 /* AFSecurityPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 2995224B1BBF125A00859F49 /* AFSecurityPolicy.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 299522591BBF125A00859F49 /* AFSecurityPolicy.m in Sources */ = {isa = PBXBuildFile; fileRef = 2995224C1BBF125A00859F49 /* AFSecurityPolicy.m */; }; + 2995225A1BBF125A00859F49 /* AFURLRequestSerialization.h in Headers */ = {isa = PBXBuildFile; fileRef = 2995224D1BBF125A00859F49 /* AFURLRequestSerialization.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2995225B1BBF125A00859F49 /* AFURLRequestSerialization.m in Sources */ = {isa = PBXBuildFile; fileRef = 2995224E1BBF125A00859F49 /* AFURLRequestSerialization.m */; }; + 2995225C1BBF125A00859F49 /* AFURLResponseSerialization.h in Headers */ = {isa = PBXBuildFile; fileRef = 2995224F1BBF125A00859F49 /* AFURLResponseSerialization.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2995225D1BBF125A00859F49 /* AFURLResponseSerialization.m in Sources */ = {isa = PBXBuildFile; fileRef = 299522501BBF125A00859F49 /* AFURLResponseSerialization.m */; }; + 2995225E1BBF125A00859F49 /* AFURLSessionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522511BBF125A00859F49 /* AFURLSessionManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2995225F1BBF125A00859F49 /* AFURLSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 299522521BBF125A00859F49 /* AFURLSessionManager.m */; }; + 2995226D1BBF133400859F49 /* AFHTTPSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 299522471BBF125A00859F49 /* AFHTTPSessionManager.m */; }; + 2995226E1BBF133400859F49 /* AFSecurityPolicy.m in Sources */ = {isa = PBXBuildFile; fileRef = 2995224C1BBF125A00859F49 /* AFSecurityPolicy.m */; }; + 2995226F1BBF133400859F49 /* AFURLRequestSerialization.m in Sources */ = {isa = PBXBuildFile; fileRef = 2995224E1BBF125A00859F49 /* AFURLRequestSerialization.m */; }; + 299522701BBF133400859F49 /* AFURLResponseSerialization.m in Sources */ = {isa = PBXBuildFile; fileRef = 299522501BBF125A00859F49 /* AFURLResponseSerialization.m */; }; + 299522711BBF133400859F49 /* AFURLSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 299522521BBF125A00859F49 /* AFURLSessionManager.m */; }; + 2995227F1BBF13A100859F49 /* AFHTTPSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 299522471BBF125A00859F49 /* AFHTTPSessionManager.m */; }; + 299522801BBF13A100859F49 /* AFNetworkReachabilityManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 2995224A1BBF125A00859F49 /* AFNetworkReachabilityManager.m */; }; + 299522811BBF13A100859F49 /* AFSecurityPolicy.m in Sources */ = {isa = PBXBuildFile; fileRef = 2995224C1BBF125A00859F49 /* AFSecurityPolicy.m */; }; + 299522821BBF13A100859F49 /* AFURLRequestSerialization.m in Sources */ = {isa = PBXBuildFile; fileRef = 2995224E1BBF125A00859F49 /* AFURLRequestSerialization.m */; }; + 299522831BBF13A100859F49 /* AFURLResponseSerialization.m in Sources */ = {isa = PBXBuildFile; fileRef = 299522501BBF125A00859F49 /* AFURLResponseSerialization.m */; }; + 299522841BBF13A100859F49 /* AFURLSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 299522521BBF125A00859F49 /* AFURLSessionManager.m */; }; + 2995229C1BBF13C700859F49 /* AFAutoPurgingImageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522861BBF13C700859F49 /* AFAutoPurgingImageCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2995229D1BBF13C700859F49 /* AFAutoPurgingImageCache.m in Sources */ = {isa = PBXBuildFile; fileRef = 299522871BBF13C700859F49 /* AFAutoPurgingImageCache.m */; }; + 2995229E1BBF13C700859F49 /* AFImageDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522881BBF13C700859F49 /* AFImageDownloader.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 2995229F1BBF13C700859F49 /* AFImageDownloader.m in Sources */ = {isa = PBXBuildFile; fileRef = 299522891BBF13C700859F49 /* AFImageDownloader.m */; }; + 299522A01BBF13C700859F49 /* AFNetworkActivityIndicatorManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 2995228A1BBF13C700859F49 /* AFNetworkActivityIndicatorManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 299522A11BBF13C700859F49 /* AFNetworkActivityIndicatorManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 2995228B1BBF13C700859F49 /* AFNetworkActivityIndicatorManager.m */; }; + 299522A21BBF13C700859F49 /* UIActivityIndicatorView+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 2995228C1BBF13C700859F49 /* UIActivityIndicatorView+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 299522A31BBF13C700859F49 /* UIActivityIndicatorView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 2995228D1BBF13C700859F49 /* UIActivityIndicatorView+AFNetworking.m */; }; + 299522A61BBF13C700859F49 /* UIButton+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522901BBF13C700859F49 /* UIButton+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 299522A71BBF13C700859F49 /* UIButton+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 299522911BBF13C700859F49 /* UIButton+AFNetworking.m */; }; + 299522A81BBF13C700859F49 /* UIImage+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522921BBF13C700859F49 /* UIImage+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 299522A91BBF13C700859F49 /* UIImageView+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522931BBF13C700859F49 /* UIImageView+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 299522AA1BBF13C700859F49 /* UIImageView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 299522941BBF13C700859F49 /* UIImageView+AFNetworking.m */; }; + 299522AC1BBF13C700859F49 /* UIProgressView+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522961BBF13C700859F49 /* UIProgressView+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 299522AD1BBF13C700859F49 /* UIProgressView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 299522971BBF13C700859F49 /* UIProgressView+AFNetworking.m */; }; + 299522AE1BBF13C700859F49 /* UIRefreshControl+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522981BBF13C700859F49 /* UIRefreshControl+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 299522AF1BBF13C700859F49 /* UIRefreshControl+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 299522991BBF13C700859F49 /* UIRefreshControl+AFNetworking.m */; }; + 299522B01BBF13C700859F49 /* UIWebView+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 2995229A1BBF13C700859F49 /* UIWebView+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 299522B11BBF13C700859F49 /* UIWebView+AFNetworking.m in Sources */ = {isa = PBXBuildFile; fileRef = 2995229B1BBF13C700859F49 /* UIWebView+AFNetworking.m */; }; + 29D3413F1C20D46400A7D266 /* AFCompoundResponseSerializerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 29D3413E1C20D46400A7D266 /* AFCompoundResponseSerializerTests.m */; }; + 29D341401C20D46400A7D266 /* AFCompoundResponseSerializerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 29D3413E1C20D46400A7D266 /* AFCompoundResponseSerializerTests.m */; }; + 29D341411C20D46400A7D266 /* AFCompoundResponseSerializerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 29D3413E1C20D46400A7D266 /* AFCompoundResponseSerializerTests.m */; }; + 29D96E7A1BCC3D6000F571A5 /* AFHTTPSessionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522461BBF125A00859F49 /* AFHTTPSessionManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 29D96E7C1BCC3D6000F571A5 /* AFSecurityPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 2995224B1BBF125A00859F49 /* AFSecurityPolicy.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 29D96E7D1BCC3D6000F571A5 /* AFURLRequestSerialization.h in Headers */ = {isa = PBXBuildFile; fileRef = 2995224D1BBF125A00859F49 /* AFURLRequestSerialization.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 29D96E7E1BCC3D6000F571A5 /* AFURLResponseSerialization.h in Headers */ = {isa = PBXBuildFile; fileRef = 2995224F1BBF125A00859F49 /* AFURLResponseSerialization.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 29D96E7F1BCC3D6000F571A5 /* AFURLSessionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522511BBF125A00859F49 /* AFURLSessionManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 29D96E801BCC3D6000F571A5 /* AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 2995223C1BBF104D00859F49 /* AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 29D96E811BCC3D7200F571A5 /* AFHTTPSessionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522461BBF125A00859F49 /* AFHTTPSessionManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 29D96E821BCC3D7200F571A5 /* AFNetworkReachabilityManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522491BBF125A00859F49 /* AFNetworkReachabilityManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 29D96E831BCC3D7200F571A5 /* AFSecurityPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 2995224B1BBF125A00859F49 /* AFSecurityPolicy.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 29D96E841BCC3D7200F571A5 /* AFURLRequestSerialization.h in Headers */ = {isa = PBXBuildFile; fileRef = 2995224D1BBF125A00859F49 /* AFURLRequestSerialization.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 29D96E851BCC3D7200F571A5 /* AFURLResponseSerialization.h in Headers */ = {isa = PBXBuildFile; fileRef = 2995224F1BBF125A00859F49 /* AFURLResponseSerialization.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 29D96E861BCC3D7200F571A5 /* AFURLSessionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522511BBF125A00859F49 /* AFURLSessionManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 29D96E871BCC3D7200F571A5 /* AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 2995223C1BBF104D00859F49 /* AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 29D96E881BCC3D7D00F571A5 /* AFHTTPSessionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522461BBF125A00859F49 /* AFHTTPSessionManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 29D96E891BCC3D7D00F571A5 /* AFNetworkReachabilityManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522491BBF125A00859F49 /* AFNetworkReachabilityManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 29D96E8A1BCC3D7D00F571A5 /* AFSecurityPolicy.h in Headers */ = {isa = PBXBuildFile; fileRef = 2995224B1BBF125A00859F49 /* AFSecurityPolicy.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 29D96E8B1BCC3D7D00F571A5 /* AFURLRequestSerialization.h in Headers */ = {isa = PBXBuildFile; fileRef = 2995224D1BBF125A00859F49 /* AFURLRequestSerialization.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 29D96E8C1BCC3D7D00F571A5 /* AFURLResponseSerialization.h in Headers */ = {isa = PBXBuildFile; fileRef = 2995224F1BBF125A00859F49 /* AFURLResponseSerialization.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 29D96E8D1BCC3D7D00F571A5 /* AFURLSessionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522511BBF125A00859F49 /* AFURLSessionManager.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 29D96E8E1BCC3D7D00F571A5 /* AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 2995223C1BBF104D00859F49 /* AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 29D96E941BCC406B00F571A5 /* AFAutoPurgingImageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522861BBF13C700859F49 /* AFAutoPurgingImageCache.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 29D96E951BCC406B00F571A5 /* AFImageDownloader.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522881BBF13C700859F49 /* AFImageDownloader.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 29D96E961BCC406B00F571A5 /* UIActivityIndicatorView+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 2995228C1BBF13C700859F49 /* UIActivityIndicatorView+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 29D96E971BCC406B00F571A5 /* UIButton+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522901BBF13C700859F49 /* UIButton+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 29D96E981BCC406B00F571A5 /* UIImage+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522921BBF13C700859F49 /* UIImage+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 29D96E991BCC406B00F571A5 /* UIImageView+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522931BBF13C700859F49 /* UIImageView+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 29D96E9A1BCC406B00F571A5 /* UIProgressView+AFNetworking.h in Headers */ = {isa = PBXBuildFile; fileRef = 299522961BBF13C700859F49 /* UIProgressView+AFNetworking.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 29F5EF031C47E64F008B976A /* AFUIWebViewTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 29F5EF021C47E64F008B976A /* AFUIWebViewTests.m */; }; + 5F4323BB1BF63741003B8749 /* Equifax_Secure_Certificate_Authority_Root.cer in Resources */ = {isa = PBXBuildFile; fileRef = 5F4323B31BF63741003B8749 /* Equifax_Secure_Certificate_Authority_Root.cer */; }; + 5F4323BC1BF63741003B8749 /* Equifax_Secure_Certificate_Authority_Root.cer in Resources */ = {isa = PBXBuildFile; fileRef = 5F4323B31BF63741003B8749 /* Equifax_Secure_Certificate_Authority_Root.cer */; }; + 5F4323BD1BF63741003B8749 /* Equifax_Secure_Certificate_Authority_Root.cer in Resources */ = {isa = PBXBuildFile; fileRef = 5F4323B31BF63741003B8749 /* Equifax_Secure_Certificate_Authority_Root.cer */; }; + 5F4323BE1BF63741003B8749 /* GeoTrust_Global_CA-cross.cer in Resources */ = {isa = PBXBuildFile; fileRef = 5F4323B41BF63741003B8749 /* GeoTrust_Global_CA-cross.cer */; }; + 5F4323BF1BF63741003B8749 /* GeoTrust_Global_CA-cross.cer in Resources */ = {isa = PBXBuildFile; fileRef = 5F4323B41BF63741003B8749 /* GeoTrust_Global_CA-cross.cer */; }; + 5F4323C01BF63741003B8749 /* GeoTrust_Global_CA-cross.cer in Resources */ = {isa = PBXBuildFile; fileRef = 5F4323B41BF63741003B8749 /* GeoTrust_Global_CA-cross.cer */; }; + 5F4323C11BF63741003B8749 /* google.com.cer in Resources */ = {isa = PBXBuildFile; fileRef = 5F4323B51BF63741003B8749 /* google.com.cer */; }; + 5F4323C21BF63741003B8749 /* google.com.cer in Resources */ = {isa = PBXBuildFile; fileRef = 5F4323B51BF63741003B8749 /* google.com.cer */; }; + 5F4323C31BF63741003B8749 /* google.com.cer in Resources */ = {isa = PBXBuildFile; fileRef = 5F4323B51BF63741003B8749 /* google.com.cer */; }; + 5F4323CD1BF63741003B8749 /* GoogleInternetAuthorityG2.cer in Resources */ = {isa = PBXBuildFile; fileRef = 5F4323BA1BF63741003B8749 /* GoogleInternetAuthorityG2.cer */; }; + 5F4323CE1BF63741003B8749 /* GoogleInternetAuthorityG2.cer in Resources */ = {isa = PBXBuildFile; fileRef = 5F4323BA1BF63741003B8749 /* GoogleInternetAuthorityG2.cer */; }; + 5F4323CF1BF63741003B8749 /* GoogleInternetAuthorityG2.cer in Resources */ = {isa = PBXBuildFile; fileRef = 5F4323BA1BF63741003B8749 /* GoogleInternetAuthorityG2.cer */; }; + 5F4323D51BF63CB0003B8749 /* GoogleComServerTrustChainPath1 in Resources */ = {isa = PBXBuildFile; fileRef = 5F4323D41BF63CB0003B8749 /* GoogleComServerTrustChainPath1 */; }; + 5F4323D61BF63CB0003B8749 /* GoogleComServerTrustChainPath1 in Resources */ = {isa = PBXBuildFile; fileRef = 5F4323D41BF63CB0003B8749 /* GoogleComServerTrustChainPath1 */; }; + 5F4323D71BF63CB0003B8749 /* GoogleComServerTrustChainPath1 in Resources */ = {isa = PBXBuildFile; fileRef = 5F4323D41BF63CB0003B8749 /* GoogleComServerTrustChainPath1 */; }; + 5F4323D91BF63CBA003B8749 /* GoogleComServerTrustChainPath2 in Resources */ = {isa = PBXBuildFile; fileRef = 5F4323D81BF63CBA003B8749 /* GoogleComServerTrustChainPath2 */; }; + 5F4323DA1BF63CBA003B8749 /* GoogleComServerTrustChainPath2 in Resources */ = {isa = PBXBuildFile; fileRef = 5F4323D81BF63CBA003B8749 /* GoogleComServerTrustChainPath2 */; }; + 5F4323DB1BF63CBA003B8749 /* GoogleComServerTrustChainPath2 in Resources */ = {isa = PBXBuildFile; fileRef = 5F4323D81BF63CBA003B8749 /* GoogleComServerTrustChainPath2 */; }; + 5F4323DD1BF63CCC003B8749 /* GeoTrust_Global_CA_Root.cer in Resources */ = {isa = PBXBuildFile; fileRef = 5F4323DC1BF63CCC003B8749 /* GeoTrust_Global_CA_Root.cer */; }; + 5F4323DE1BF63CCC003B8749 /* GeoTrust_Global_CA_Root.cer in Resources */ = {isa = PBXBuildFile; fileRef = 5F4323DC1BF63CCC003B8749 /* GeoTrust_Global_CA_Root.cer */; }; + 5F4323DF1BF63CCC003B8749 /* GeoTrust_Global_CA_Root.cer in Resources */ = {isa = PBXBuildFile; fileRef = 5F4323DC1BF63CCC003B8749 /* GeoTrust_Global_CA_Root.cer */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 2987B0B01BC408A200179A4C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 299522301BBF104D00859F49 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 2987B0A41BC408A200179A4C; + remoteInfo = "AFNetworking tvOS"; + }; + 298D7C411BC2C79500FD3B3E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 299522301BBF104D00859F49 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 299522381BBF104D00859F49; + remoteInfo = "AFNetworking iOS"; + }; + 298D7C501BC2C7B200FD3B3E /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 299522301BBF104D00859F49 /* Project object */; + proxyType = 1; + remoteGlobalIDString = 299522761BBF136400859F49; + remoteInfo = "AFNetworking OS X"; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 1FE783001C58579D00A73B7C /* httpbinorg_01192017.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = httpbinorg_01192017.cer; sourceTree = ""; }; + 2960BAC21C1B2F1A00BA02F0 /* AFUIButtonTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFUIButtonTests.m; sourceTree = ""; }; + 297824A01BC2D69A0041C395 /* adn_0.cer */ = {isa = PBXFileReference; lastKnownFileType = file; name = adn_0.cer; path = ADNNetServerTrustChain/adn_0.cer; sourceTree = ""; }; + 297824A11BC2D69A0041C395 /* adn_1.cer */ = {isa = PBXFileReference; lastKnownFileType = file; name = adn_1.cer; path = ADNNetServerTrustChain/adn_1.cer; sourceTree = ""; }; + 297824A21BC2D69A0041C395 /* adn_2.cer */ = {isa = PBXFileReference; lastKnownFileType = file; name = adn_2.cer; path = ADNNetServerTrustChain/adn_2.cer; sourceTree = ""; }; + 2987B0A51BC408A200179A4C /* AFNetworking.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AFNetworking.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 2987B0AE1BC408A200179A4C /* AFNetworking tvOS Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "AFNetworking tvOS Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 298D7C3B1BC2C79500FD3B3E /* AFNetworking iOS Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "AFNetworking iOS Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 298D7C4A1BC2C7B200FD3B3E /* AFNetworking Mac OS X Tests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = "AFNetworking Mac OS X Tests.xctest"; sourceTree = BUILT_PRODUCTS_DIR; }; + 298D7C6E1BC2C88F00FD3B3E /* AddTrust_External_CA_Root.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = AddTrust_External_CA_Root.cer; sourceTree = ""; }; + 298D7C6F1BC2C88F00FD3B3E /* COMODO_RSA_Certification_Authority.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = COMODO_RSA_Certification_Authority.cer; sourceTree = ""; }; + 298D7C701BC2C88F00FD3B3E /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = COMODO_RSA_Domain_Validation_Secure_Server_CA.cer; sourceTree = ""; }; + 298D7C771BC2C88F00FD3B3E /* logo.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = logo.png; sourceTree = ""; }; + 298D7C791BC2C88F00FD3B3E /* AltName.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = AltName.cer; sourceTree = ""; }; + 298D7C7A1BC2C88F00FD3B3E /* foobar.com.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = foobar.com.cer; sourceTree = ""; }; + 298D7C7B1BC2C88F00FD3B3E /* NoDomains.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = NoDomains.cer; sourceTree = ""; }; + 298D7C801BC2C88F00FD3B3E /* AFAutoPurgingImageCacheTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AFAutoPurgingImageCacheTests.m; sourceTree = ""; }; + 298D7C811BC2C88F00FD3B3E /* AFHTTPRequestSerializationTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AFHTTPRequestSerializationTests.m; sourceTree = ""; }; + 298D7C821BC2C88F00FD3B3E /* AFHTTPResponseSerializationTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AFHTTPResponseSerializationTests.m; sourceTree = ""; }; + 298D7C831BC2C88F00FD3B3E /* AFHTTPSessionManagerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AFHTTPSessionManagerTests.m; sourceTree = ""; }; + 298D7C841BC2C88F00FD3B3E /* AFImageDownloaderTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AFImageDownloaderTests.m; sourceTree = ""; }; + 298D7C851BC2C88F00FD3B3E /* AFJSONSerializationTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AFJSONSerializationTests.m; sourceTree = ""; }; + 298D7C861BC2C88F00FD3B3E /* AFNetworkActivityManagerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AFNetworkActivityManagerTests.m; sourceTree = ""; }; + 298D7C871BC2C88F00FD3B3E /* AFNetworkReachabilityManagerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AFNetworkReachabilityManagerTests.m; sourceTree = ""; }; + 298D7C881BC2C88F00FD3B3E /* AFPropertyListResponseSerializerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AFPropertyListResponseSerializerTests.m; sourceTree = ""; }; + 298D7C891BC2C88F00FD3B3E /* AFSecurityPolicyTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AFSecurityPolicyTests.m; sourceTree = ""; }; + 298D7C8A1BC2C88F00FD3B3E /* AFTestCase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AFTestCase.h; sourceTree = ""; }; + 298D7C8B1BC2C88F00FD3B3E /* AFTestCase.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AFTestCase.m; sourceTree = ""; }; + 298D7C8C1BC2C88F00FD3B3E /* AFUIActivityIndicatorViewTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AFUIActivityIndicatorViewTests.m; sourceTree = ""; }; + 298D7C8D1BC2C88F00FD3B3E /* AFUIImageViewTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AFUIImageViewTests.m; sourceTree = ""; }; + 298D7C8E1BC2C88F00FD3B3E /* AFUIRefreshControlTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AFUIRefreshControlTests.m; sourceTree = ""; }; + 298D7C8F1BC2C88F00FD3B3E /* AFURLSessionManagerTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AFURLSessionManagerTests.m; sourceTree = ""; }; + 298D7CDF1BC2CB5A00FD3B3E /* ADNNetServerTrustChain */ = {isa = PBXFileReference; lastKnownFileType = folder; path = ADNNetServerTrustChain; sourceTree = ""; }; + 298D7CE21BC2CB7C00FD3B3E /* HTTPBinOrgServerTrustChain */ = {isa = PBXFileReference; lastKnownFileType = folder; path = HTTPBinOrgServerTrustChain; sourceTree = ""; }; + 299522391BBF104D00859F49 /* AFNetworking.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AFNetworking.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 2995223C1BBF104D00859F49 /* AFNetworking.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = AFNetworking.h; path = ../Framework/AFNetworking.h; sourceTree = ""; }; + 2995223E1BBF104D00859F49 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; name = Info.plist; path = ../Framework/Info.plist; sourceTree = ""; }; + 299522461BBF125A00859F49 /* AFHTTPSessionManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFHTTPSessionManager.h; sourceTree = ""; }; + 299522471BBF125A00859F49 /* AFHTTPSessionManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFHTTPSessionManager.m; sourceTree = ""; }; + 299522491BBF125A00859F49 /* AFNetworkReachabilityManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFNetworkReachabilityManager.h; sourceTree = ""; }; + 2995224A1BBF125A00859F49 /* AFNetworkReachabilityManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFNetworkReachabilityManager.m; sourceTree = ""; }; + 2995224B1BBF125A00859F49 /* AFSecurityPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFSecurityPolicy.h; sourceTree = ""; }; + 2995224C1BBF125A00859F49 /* AFSecurityPolicy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFSecurityPolicy.m; sourceTree = ""; }; + 2995224D1BBF125A00859F49 /* AFURLRequestSerialization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFURLRequestSerialization.h; sourceTree = ""; }; + 2995224E1BBF125A00859F49 /* AFURLRequestSerialization.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFURLRequestSerialization.m; sourceTree = ""; }; + 2995224F1BBF125A00859F49 /* AFURLResponseSerialization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFURLResponseSerialization.h; sourceTree = ""; }; + 299522501BBF125A00859F49 /* AFURLResponseSerialization.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFURLResponseSerialization.m; sourceTree = ""; }; + 299522511BBF125A00859F49 /* AFURLSessionManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFURLSessionManager.h; sourceTree = ""; }; + 299522521BBF125A00859F49 /* AFURLSessionManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFURLSessionManager.m; sourceTree = ""; }; + 299522651BBF129200859F49 /* AFNetworking.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AFNetworking.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 299522771BBF136400859F49 /* AFNetworking.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = AFNetworking.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + 299522861BBF13C700859F49 /* AFAutoPurgingImageCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFAutoPurgingImageCache.h; sourceTree = ""; }; + 299522871BBF13C700859F49 /* AFAutoPurgingImageCache.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFAutoPurgingImageCache.m; sourceTree = ""; }; + 299522881BBF13C700859F49 /* AFImageDownloader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFImageDownloader.h; sourceTree = ""; }; + 299522891BBF13C700859F49 /* AFImageDownloader.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFImageDownloader.m; sourceTree = ""; }; + 2995228A1BBF13C700859F49 /* AFNetworkActivityIndicatorManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFNetworkActivityIndicatorManager.h; sourceTree = ""; }; + 2995228B1BBF13C700859F49 /* AFNetworkActivityIndicatorManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFNetworkActivityIndicatorManager.m; sourceTree = ""; }; + 2995228C1BBF13C700859F49 /* UIActivityIndicatorView+AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIActivityIndicatorView+AFNetworking.h"; sourceTree = ""; }; + 2995228D1BBF13C700859F49 /* UIActivityIndicatorView+AFNetworking.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIActivityIndicatorView+AFNetworking.m"; sourceTree = ""; }; + 299522901BBF13C700859F49 /* UIButton+AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIButton+AFNetworking.h"; sourceTree = ""; }; + 299522911BBF13C700859F49 /* UIButton+AFNetworking.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIButton+AFNetworking.m"; sourceTree = ""; }; + 299522921BBF13C700859F49 /* UIImage+AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImage+AFNetworking.h"; sourceTree = ""; }; + 299522931BBF13C700859F49 /* UIImageView+AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIImageView+AFNetworking.h"; sourceTree = ""; }; + 299522941BBF13C700859F49 /* UIImageView+AFNetworking.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIImageView+AFNetworking.m"; sourceTree = ""; }; + 299522951BBF13C700859F49 /* UIKit+AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIKit+AFNetworking.h"; sourceTree = ""; }; + 299522961BBF13C700859F49 /* UIProgressView+AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIProgressView+AFNetworking.h"; sourceTree = ""; }; + 299522971BBF13C700859F49 /* UIProgressView+AFNetworking.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIProgressView+AFNetworking.m"; sourceTree = ""; }; + 299522981BBF13C700859F49 /* UIRefreshControl+AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIRefreshControl+AFNetworking.h"; sourceTree = ""; }; + 299522991BBF13C700859F49 /* UIRefreshControl+AFNetworking.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIRefreshControl+AFNetworking.m"; sourceTree = ""; }; + 2995229A1BBF13C700859F49 /* UIWebView+AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIWebView+AFNetworking.h"; sourceTree = ""; }; + 2995229B1BBF13C700859F49 /* UIWebView+AFNetworking.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIWebView+AFNetworking.m"; sourceTree = ""; }; + 29D3413E1C20D46400A7D266 /* AFCompoundResponseSerializerTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFCompoundResponseSerializerTests.m; sourceTree = ""; }; + 29F5EF021C47E64F008B976A /* AFUIWebViewTests.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFUIWebViewTests.m; sourceTree = ""; }; + 5F4323B31BF63741003B8749 /* Equifax_Secure_Certificate_Authority_Root.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = Equifax_Secure_Certificate_Authority_Root.cer; sourceTree = ""; }; + 5F4323B41BF63741003B8749 /* GeoTrust_Global_CA-cross.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = "GeoTrust_Global_CA-cross.cer"; sourceTree = ""; }; + 5F4323B51BF63741003B8749 /* google.com.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = google.com.cer; sourceTree = ""; }; + 5F4323BA1BF63741003B8749 /* GoogleInternetAuthorityG2.cer */ = {isa = PBXFileReference; lastKnownFileType = file; path = GoogleInternetAuthorityG2.cer; sourceTree = ""; }; + 5F4323D41BF63CB0003B8749 /* GoogleComServerTrustChainPath1 */ = {isa = PBXFileReference; lastKnownFileType = folder; path = GoogleComServerTrustChainPath1; sourceTree = ""; }; + 5F4323D81BF63CBA003B8749 /* GoogleComServerTrustChainPath2 */ = {isa = PBXFileReference; lastKnownFileType = folder; path = GoogleComServerTrustChainPath2; sourceTree = ""; }; + 5F4323DC1BF63CCC003B8749 /* GeoTrust_Global_CA_Root.cer */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = GeoTrust_Global_CA_Root.cer; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 2987B0A11BC408A200179A4C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2987B0AB1BC408A200179A4C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 2987B0AF1BC408A200179A4C /* AFNetworking.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 298D7C381BC2C79500FD3B3E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 297824AB1BC2DB060041C395 /* AFNetworking.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 298D7C471BC2C7B200FD3B3E /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 298D7C4F1BC2C7B200FD3B3E /* AFNetworking.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 299522351BBF104D00859F49 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 299522611BBF129200859F49 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 299522731BBF136400859F49 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 298D7C561BC2C88F00FD3B3E /* Tests */ = { + isa = PBXGroup; + children = ( + 298D7C671BC2C88F00FD3B3E /* Resources */, + 298D7C7F1BC2C88F00FD3B3E /* Tests */, + ); + path = Tests; + sourceTree = ""; + }; + 298D7C671BC2C88F00FD3B3E /* Resources */ = { + isa = PBXGroup; + children = ( + 298D7C681BC2C88F00FD3B3E /* ADN.net */, + 298D7C6D1BC2C88F00FD3B3E /* HTTPBin.org */, + 298D7C771BC2C88F00FD3B3E /* logo.png */, + 298D7C781BC2C88F00FD3B3E /* SelfSigned */, + 5F4323B21BF63741003B8749 /* Google.com */, + ); + path = Resources; + sourceTree = ""; + }; + 298D7C681BC2C88F00FD3B3E /* ADN.net */ = { + isa = PBXGroup; + children = ( + 297824A01BC2D69A0041C395 /* adn_0.cer */, + 297824A11BC2D69A0041C395 /* adn_1.cer */, + 297824A21BC2D69A0041C395 /* adn_2.cer */, + 298D7CDF1BC2CB5A00FD3B3E /* ADNNetServerTrustChain */, + ); + path = ADN.net; + sourceTree = ""; + }; + 298D7C6D1BC2C88F00FD3B3E /* HTTPBin.org */ = { + isa = PBXGroup; + children = ( + 298D7CE21BC2CB7C00FD3B3E /* HTTPBinOrgServerTrustChain */, + 298D7C6E1BC2C88F00FD3B3E /* AddTrust_External_CA_Root.cer */, + 298D7C6F1BC2C88F00FD3B3E /* COMODO_RSA_Certification_Authority.cer */, + 298D7C701BC2C88F00FD3B3E /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer */, + 1FE783001C58579D00A73B7C /* httpbinorg_01192017.cer */, + ); + path = HTTPBin.org; + sourceTree = ""; + }; + 298D7C781BC2C88F00FD3B3E /* SelfSigned */ = { + isa = PBXGroup; + children = ( + 298D7C791BC2C88F00FD3B3E /* AltName.cer */, + 298D7C7A1BC2C88F00FD3B3E /* foobar.com.cer */, + 298D7C7B1BC2C88F00FD3B3E /* NoDomains.cer */, + ); + path = SelfSigned; + sourceTree = ""; + }; + 298D7C7F1BC2C88F00FD3B3E /* Tests */ = { + isa = PBXGroup; + children = ( + 298D7CD21BC2CAD500FD3B3E /* AFNetworking UIKit Tests */, + 298D7CD11BC2CABE00FD3B3E /* AFNetworking Tests */, + 298D7C8A1BC2C88F00FD3B3E /* AFTestCase.h */, + 298D7C8B1BC2C88F00FD3B3E /* AFTestCase.m */, + ); + path = Tests; + sourceTree = ""; + }; + 298D7CD11BC2CABE00FD3B3E /* AFNetworking Tests */ = { + isa = PBXGroup; + children = ( + 298D7C811BC2C88F00FD3B3E /* AFHTTPRequestSerializationTests.m */, + 298D7C821BC2C88F00FD3B3E /* AFHTTPResponseSerializationTests.m */, + 298D7C831BC2C88F00FD3B3E /* AFHTTPSessionManagerTests.m */, + 298D7C851BC2C88F00FD3B3E /* AFJSONSerializationTests.m */, + 298D7C881BC2C88F00FD3B3E /* AFPropertyListResponseSerializerTests.m */, + 29D3413E1C20D46400A7D266 /* AFCompoundResponseSerializerTests.m */, + 298D7C871BC2C88F00FD3B3E /* AFNetworkReachabilityManagerTests.m */, + 298D7C891BC2C88F00FD3B3E /* AFSecurityPolicyTests.m */, + 298D7C8F1BC2C88F00FD3B3E /* AFURLSessionManagerTests.m */, + ); + name = "AFNetworking Tests"; + sourceTree = ""; + }; + 298D7CD21BC2CAD500FD3B3E /* AFNetworking UIKit Tests */ = { + isa = PBXGroup; + children = ( + 298D7C801BC2C88F00FD3B3E /* AFAutoPurgingImageCacheTests.m */, + 298D7C841BC2C88F00FD3B3E /* AFImageDownloaderTests.m */, + 298D7C861BC2C88F00FD3B3E /* AFNetworkActivityManagerTests.m */, + 298D7C8C1BC2C88F00FD3B3E /* AFUIActivityIndicatorViewTests.m */, + 298D7C8D1BC2C88F00FD3B3E /* AFUIImageViewTests.m */, + 298D7C8E1BC2C88F00FD3B3E /* AFUIRefreshControlTests.m */, + 2960BAC21C1B2F1A00BA02F0 /* AFUIButtonTests.m */, + 29F5EF021C47E64F008B976A /* AFUIWebViewTests.m */, + ); + name = "AFNetworking UIKit Tests"; + sourceTree = ""; + }; + 2995222F1BBF104D00859F49 = { + isa = PBXGroup; + children = ( + 299522451BBF125A00859F49 /* AFNetworking */, + 299522851BBF13C700859F49 /* UIKit+AFNetworking */, + 2995223B1BBF104D00859F49 /* Supporting Files */, + 298D7C561BC2C88F00FD3B3E /* Tests */, + 2995223A1BBF104D00859F49 /* Products */, + ); + indentWidth = 4; + sourceTree = ""; + tabWidth = 4; + usesTabs = 0; + }; + 2995223A1BBF104D00859F49 /* Products */ = { + isa = PBXGroup; + children = ( + 299522391BBF104D00859F49 /* AFNetworking.framework */, + 299522651BBF129200859F49 /* AFNetworking.framework */, + 299522771BBF136400859F49 /* AFNetworking.framework */, + 298D7C3B1BC2C79500FD3B3E /* AFNetworking iOS Tests.xctest */, + 298D7C4A1BC2C7B200FD3B3E /* AFNetworking Mac OS X Tests.xctest */, + 2987B0A51BC408A200179A4C /* AFNetworking.framework */, + 2987B0AE1BC408A200179A4C /* AFNetworking tvOS Tests.xctest */, + ); + name = Products; + sourceTree = ""; + }; + 2995223B1BBF104D00859F49 /* Supporting Files */ = { + isa = PBXGroup; + children = ( + 2995223C1BBF104D00859F49 /* AFNetworking.h */, + 2995223E1BBF104D00859F49 /* Info.plist */, + ); + name = "Supporting Files"; + path = AFNetworking; + sourceTree = ""; + }; + 299522451BBF125A00859F49 /* AFNetworking */ = { + isa = PBXGroup; + children = ( + 299522461BBF125A00859F49 /* AFHTTPSessionManager.h */, + 299522471BBF125A00859F49 /* AFHTTPSessionManager.m */, + 299522491BBF125A00859F49 /* AFNetworkReachabilityManager.h */, + 2995224A1BBF125A00859F49 /* AFNetworkReachabilityManager.m */, + 2995224B1BBF125A00859F49 /* AFSecurityPolicy.h */, + 2995224C1BBF125A00859F49 /* AFSecurityPolicy.m */, + 2995224D1BBF125A00859F49 /* AFURLRequestSerialization.h */, + 2995224E1BBF125A00859F49 /* AFURLRequestSerialization.m */, + 2995224F1BBF125A00859F49 /* AFURLResponseSerialization.h */, + 299522501BBF125A00859F49 /* AFURLResponseSerialization.m */, + 299522511BBF125A00859F49 /* AFURLSessionManager.h */, + 299522521BBF125A00859F49 /* AFURLSessionManager.m */, + ); + path = AFNetworking; + sourceTree = ""; + }; + 299522851BBF13C700859F49 /* UIKit+AFNetworking */ = { + isa = PBXGroup; + children = ( + 299522861BBF13C700859F49 /* AFAutoPurgingImageCache.h */, + 299522871BBF13C700859F49 /* AFAutoPurgingImageCache.m */, + 299522881BBF13C700859F49 /* AFImageDownloader.h */, + 299522891BBF13C700859F49 /* AFImageDownloader.m */, + 2995228A1BBF13C700859F49 /* AFNetworkActivityIndicatorManager.h */, + 2995228B1BBF13C700859F49 /* AFNetworkActivityIndicatorManager.m */, + 2995228C1BBF13C700859F49 /* UIActivityIndicatorView+AFNetworking.h */, + 2995228D1BBF13C700859F49 /* UIActivityIndicatorView+AFNetworking.m */, + 299522901BBF13C700859F49 /* UIButton+AFNetworking.h */, + 299522911BBF13C700859F49 /* UIButton+AFNetworking.m */, + 299522921BBF13C700859F49 /* UIImage+AFNetworking.h */, + 299522931BBF13C700859F49 /* UIImageView+AFNetworking.h */, + 299522941BBF13C700859F49 /* UIImageView+AFNetworking.m */, + 299522951BBF13C700859F49 /* UIKit+AFNetworking.h */, + 299522961BBF13C700859F49 /* UIProgressView+AFNetworking.h */, + 299522971BBF13C700859F49 /* UIProgressView+AFNetworking.m */, + 299522981BBF13C700859F49 /* UIRefreshControl+AFNetworking.h */, + 299522991BBF13C700859F49 /* UIRefreshControl+AFNetworking.m */, + 2995229A1BBF13C700859F49 /* UIWebView+AFNetworking.h */, + 2995229B1BBF13C700859F49 /* UIWebView+AFNetworking.m */, + ); + path = "UIKit+AFNetworking"; + sourceTree = ""; + }; + 5F4323B21BF63741003B8749 /* Google.com */ = { + isa = PBXGroup; + children = ( + 5F4323D41BF63CB0003B8749 /* GoogleComServerTrustChainPath1 */, + 5F4323D81BF63CBA003B8749 /* GoogleComServerTrustChainPath2 */, + 5F4323B31BF63741003B8749 /* Equifax_Secure_Certificate_Authority_Root.cer */, + 5F4323DC1BF63CCC003B8749 /* GeoTrust_Global_CA_Root.cer */, + 5F4323B41BF63741003B8749 /* GeoTrust_Global_CA-cross.cer */, + 5F4323BA1BF63741003B8749 /* GoogleInternetAuthorityG2.cer */, + 5F4323B51BF63741003B8749 /* google.com.cer */, + ); + path = Google.com; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 2987B0A21BC408A200179A4C /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 29D96E881BCC3D7D00F571A5 /* AFHTTPSessionManager.h in Headers */, + 29D96E891BCC3D7D00F571A5 /* AFNetworkReachabilityManager.h in Headers */, + 29D96E8A1BCC3D7D00F571A5 /* AFSecurityPolicy.h in Headers */, + 29D96E8B1BCC3D7D00F571A5 /* AFURLRequestSerialization.h in Headers */, + 29D96E8C1BCC3D7D00F571A5 /* AFURLResponseSerialization.h in Headers */, + 29D96E8D1BCC3D7D00F571A5 /* AFURLSessionManager.h in Headers */, + 29D96E941BCC406B00F571A5 /* AFAutoPurgingImageCache.h in Headers */, + 29D96E951BCC406B00F571A5 /* AFImageDownloader.h in Headers */, + 29D96E961BCC406B00F571A5 /* UIActivityIndicatorView+AFNetworking.h in Headers */, + 29D96E971BCC406B00F571A5 /* UIButton+AFNetworking.h in Headers */, + 29D96E981BCC406B00F571A5 /* UIImage+AFNetworking.h in Headers */, + 29D96E991BCC406B00F571A5 /* UIImageView+AFNetworking.h in Headers */, + 29D96E9A1BCC406B00F571A5 /* UIProgressView+AFNetworking.h in Headers */, + 29D96E8E1BCC3D7D00F571A5 /* AFNetworking.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 299522361BBF104D00859F49 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 2995225A1BBF125A00859F49 /* AFURLRequestSerialization.h in Headers */, + 299522A81BBF13C700859F49 /* UIImage+AFNetworking.h in Headers */, + 299522531BBF125A00859F49 /* AFHTTPSessionManager.h in Headers */, + 2995229C1BBF13C700859F49 /* AFAutoPurgingImageCache.h in Headers */, + 299522581BBF125A00859F49 /* AFSecurityPolicy.h in Headers */, + 299522561BBF125A00859F49 /* AFNetworkReachabilityManager.h in Headers */, + 299522A91BBF13C700859F49 /* UIImageView+AFNetworking.h in Headers */, + 2995229E1BBF13C700859F49 /* AFImageDownloader.h in Headers */, + 2995225E1BBF125A00859F49 /* AFURLSessionManager.h in Headers */, + 2995225C1BBF125A00859F49 /* AFURLResponseSerialization.h in Headers */, + 299522A21BBF13C700859F49 /* UIActivityIndicatorView+AFNetworking.h in Headers */, + 2995223D1BBF104D00859F49 /* AFNetworking.h in Headers */, + 299522B01BBF13C700859F49 /* UIWebView+AFNetworking.h in Headers */, + 299522AC1BBF13C700859F49 /* UIProgressView+AFNetworking.h in Headers */, + 299522A61BBF13C700859F49 /* UIButton+AFNetworking.h in Headers */, + 299522A01BBF13C700859F49 /* AFNetworkActivityIndicatorManager.h in Headers */, + 299522AE1BBF13C700859F49 /* UIRefreshControl+AFNetworking.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 299522621BBF129200859F49 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 29D96E7A1BCC3D6000F571A5 /* AFHTTPSessionManager.h in Headers */, + 29D96E7C1BCC3D6000F571A5 /* AFSecurityPolicy.h in Headers */, + 29D96E7D1BCC3D6000F571A5 /* AFURLRequestSerialization.h in Headers */, + 29D96E7E1BCC3D6000F571A5 /* AFURLResponseSerialization.h in Headers */, + 29D96E7F1BCC3D6000F571A5 /* AFURLSessionManager.h in Headers */, + 29D96E801BCC3D6000F571A5 /* AFNetworking.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 299522741BBF136400859F49 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 29D96E811BCC3D7200F571A5 /* AFHTTPSessionManager.h in Headers */, + 29D96E821BCC3D7200F571A5 /* AFNetworkReachabilityManager.h in Headers */, + 29D96E831BCC3D7200F571A5 /* AFSecurityPolicy.h in Headers */, + 29D96E841BCC3D7200F571A5 /* AFURLRequestSerialization.h in Headers */, + 29D96E851BCC3D7200F571A5 /* AFURLResponseSerialization.h in Headers */, + 29D96E861BCC3D7200F571A5 /* AFURLSessionManager.h in Headers */, + 29D96E871BCC3D7200F571A5 /* AFNetworking.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 2987B0A41BC408A200179A4C /* AFNetworking tvOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2987B0BA1BC408A200179A4C /* Build configuration list for PBXNativeTarget "AFNetworking tvOS" */; + buildPhases = ( + 2987B0A01BC408A200179A4C /* Sources */, + 2987B0A11BC408A200179A4C /* Frameworks */, + 2987B0A21BC408A200179A4C /* Headers */, + 2987B0A31BC408A200179A4C /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "AFNetworking tvOS"; + productName = "AFNetworking tvOS"; + productReference = 2987B0A51BC408A200179A4C /* AFNetworking.framework */; + productType = "com.apple.product-type.framework"; + }; + 2987B0AD1BC408A200179A4C /* AFNetworking tvOS Tests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2987B0BB1BC408A200179A4C /* Build configuration list for PBXNativeTarget "AFNetworking tvOS Tests" */; + buildPhases = ( + 2987B0AA1BC408A200179A4C /* Sources */, + 2987B0AB1BC408A200179A4C /* Frameworks */, + 2987B0AC1BC408A200179A4C /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 2987B0B11BC408A200179A4C /* PBXTargetDependency */, + ); + name = "AFNetworking tvOS Tests"; + productName = "AFNetworking tvOSTests"; + productReference = 2987B0AE1BC408A200179A4C /* AFNetworking tvOS Tests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 298D7C3A1BC2C79500FD3B3E /* AFNetworking iOS Tests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 298D7C451BC2C79600FD3B3E /* Build configuration list for PBXNativeTarget "AFNetworking iOS Tests" */; + buildPhases = ( + 298D7C371BC2C79500FD3B3E /* Sources */, + 298D7C381BC2C79500FD3B3E /* Frameworks */, + 298D7C391BC2C79500FD3B3E /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 298D7C421BC2C79500FD3B3E /* PBXTargetDependency */, + ); + name = "AFNetworking iOS Tests"; + productName = "AFNetworking iOS Tests"; + productReference = 298D7C3B1BC2C79500FD3B3E /* AFNetworking iOS Tests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 298D7C491BC2C7B200FD3B3E /* AFNetworking Mac OS X Tests */ = { + isa = PBXNativeTarget; + buildConfigurationList = 298D7C521BC2C7B200FD3B3E /* Build configuration list for PBXNativeTarget "AFNetworking Mac OS X Tests" */; + buildPhases = ( + 298D7C461BC2C7B200FD3B3E /* Sources */, + 298D7C471BC2C7B200FD3B3E /* Frameworks */, + 298D7C481BC2C7B200FD3B3E /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + 298D7C511BC2C7B200FD3B3E /* PBXTargetDependency */, + ); + name = "AFNetworking Mac OS X Tests"; + productName = "AFNetworking Mac OS X Tests"; + productReference = 298D7C4A1BC2C7B200FD3B3E /* AFNetworking Mac OS X Tests.xctest */; + productType = "com.apple.product-type.bundle.unit-test"; + }; + 299522381BBF104D00859F49 /* AFNetworking iOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 299522411BBF104D00859F49 /* Build configuration list for PBXNativeTarget "AFNetworking iOS" */; + buildPhases = ( + 299522341BBF104D00859F49 /* Sources */, + 299522351BBF104D00859F49 /* Frameworks */, + 299522361BBF104D00859F49 /* Headers */, + 299522371BBF104D00859F49 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "AFNetworking iOS"; + productName = AFNetworking; + productReference = 299522391BBF104D00859F49 /* AFNetworking.framework */; + productType = "com.apple.product-type.framework"; + }; + 299522641BBF129200859F49 /* AFNetworking watchOS */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2995226A1BBF129200859F49 /* Build configuration list for PBXNativeTarget "AFNetworking watchOS" */; + buildPhases = ( + 299522601BBF129200859F49 /* Sources */, + 299522611BBF129200859F49 /* Frameworks */, + 299522621BBF129200859F49 /* Headers */, + 299522631BBF129200859F49 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "AFNetworking watchOS"; + productName = "AFNetworking watchOS"; + productReference = 299522651BBF129200859F49 /* AFNetworking.framework */; + productType = "com.apple.product-type.framework"; + }; + 299522761BBF136400859F49 /* AFNetworking OS X */ = { + isa = PBXNativeTarget; + buildConfigurationList = 2995227C1BBF136400859F49 /* Build configuration list for PBXNativeTarget "AFNetworking OS X" */; + buildPhases = ( + 299522721BBF136400859F49 /* Sources */, + 299522731BBF136400859F49 /* Frameworks */, + 299522741BBF136400859F49 /* Headers */, + 299522751BBF136400859F49 /* Resources */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "AFNetworking OS X"; + productName = "AFNetworking OS X"; + productReference = 299522771BBF136400859F49 /* AFNetworking.framework */; + productType = "com.apple.product-type.framework"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 299522301BBF104D00859F49 /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0700; + ORGANIZATIONNAME = AFNetworking; + TargetAttributes = { + 2987B0A41BC408A200179A4C = { + CreatedOnToolsVersion = 7.1; + }; + 2987B0AD1BC408A200179A4C = { + CreatedOnToolsVersion = 7.1; + }; + 298D7C3A1BC2C79500FD3B3E = { + CreatedOnToolsVersion = 7.0.1; + }; + 298D7C491BC2C7B200FD3B3E = { + CreatedOnToolsVersion = 7.0.1; + }; + 299522381BBF104D00859F49 = { + CreatedOnToolsVersion = 7.0.1; + }; + 299522641BBF129200859F49 = { + CreatedOnToolsVersion = 7.0.1; + }; + 299522761BBF136400859F49 = { + CreatedOnToolsVersion = 7.0.1; + }; + }; + }; + buildConfigurationList = 299522331BBF104D00859F49 /* Build configuration list for PBXProject "AFNetworking" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 2995222F1BBF104D00859F49; + productRefGroup = 2995223A1BBF104D00859F49 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 299522381BBF104D00859F49 /* AFNetworking iOS */, + 299522641BBF129200859F49 /* AFNetworking watchOS */, + 299522761BBF136400859F49 /* AFNetworking OS X */, + 2987B0A41BC408A200179A4C /* AFNetworking tvOS */, + 298D7C3A1BC2C79500FD3B3E /* AFNetworking iOS Tests */, + 298D7C491BC2C7B200FD3B3E /* AFNetworking Mac OS X Tests */, + 2987B0AD1BC408A200179A4C /* AFNetworking tvOS Tests */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 2987B0A31BC408A200179A4C /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2987B0AC1BC408A200179A4C /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2987B0DE1BC40AFB00179A4C /* foobar.com.cer in Resources */, + 2987B0D61BC40AEC00179A4C /* ADNNetServerTrustChain in Resources */, + 2987B0D91BC40AF300179A4C /* COMODO_RSA_Certification_Authority.cer in Resources */, + 2987B0DF1BC40AFB00179A4C /* NoDomains.cer in Resources */, + 2987B0D41BC40AE900179A4C /* adn_1.cer in Resources */, + 2987B0DD1BC40AFB00179A4C /* AltName.cer in Resources */, + 2987B0D71BC40AF000179A4C /* HTTPBinOrgServerTrustChain in Resources */, + 2987B0D31BC40AE900179A4C /* adn_0.cer in Resources */, + 2987B0DC1BC40AF600179A4C /* logo.png in Resources */, + 2987B0D81BC40AF300179A4C /* AddTrust_External_CA_Root.cer in Resources */, + 2987B0D51BC40AE900179A4C /* adn_2.cer in Resources */, + 2987B0DA1BC40AF300179A4C /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer in Resources */, + 5F4323D71BF63CB0003B8749 /* GoogleComServerTrustChainPath1 in Resources */, + 5F4323DB1BF63CBA003B8749 /* GoogleComServerTrustChainPath2 in Resources */, + 5F4323BD1BF63741003B8749 /* Equifax_Secure_Certificate_Authority_Root.cer in Resources */, + 5F4323DF1BF63CCC003B8749 /* GeoTrust_Global_CA_Root.cer in Resources */, + 1FE783031C5857A200A73B7C /* httpbinorg_01192017.cer in Resources */, + 5F4323C01BF63741003B8749 /* GeoTrust_Global_CA-cross.cer in Resources */, + 5F4323CF1BF63741003B8749 /* GoogleInternetAuthorityG2.cer in Resources */, + 5F4323C31BF63741003B8749 /* google.com.cer in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 298D7C391BC2C79500FD3B3E /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 298D7CC51BC2CAA200FD3B3E /* AddTrust_External_CA_Root.cer in Resources */, + 298D7CBF1BC2CA9D00FD3B3E /* foobar.com.cer in Resources */, + 298D7CBA1BC2CA9800FD3B3E /* logo.png in Resources */, + 298D7CC61BC2CAA200FD3B3E /* COMODO_RSA_Certification_Authority.cer in Resources */, + 297824A31BC2D69A0041C395 /* adn_0.cer in Resources */, + 298D7CC71BC2CAA200FD3B3E /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer in Resources */, + 298D7CE31BC2CB7C00FD3B3E /* HTTPBinOrgServerTrustChain in Resources */, + 297824A71BC2D69A0041C395 /* adn_2.cer in Resources */, + 297824A51BC2D69A0041C395 /* adn_1.cer in Resources */, + 298D7CC01BC2CA9D00FD3B3E /* NoDomains.cer in Resources */, + 298D7CE01BC2CB5A00FD3B3E /* ADNNetServerTrustChain in Resources */, + 298D7CBE1BC2CA9D00FD3B3E /* AltName.cer in Resources */, + 5F4323D51BF63CB0003B8749 /* GoogleComServerTrustChainPath1 in Resources */, + 5F4323D91BF63CBA003B8749 /* GoogleComServerTrustChainPath2 in Resources */, + 5F4323BB1BF63741003B8749 /* Equifax_Secure_Certificate_Authority_Root.cer in Resources */, + 5F4323DD1BF63CCC003B8749 /* GeoTrust_Global_CA_Root.cer in Resources */, + 1FE783011C5857A100A73B7C /* httpbinorg_01192017.cer in Resources */, + 5F4323BE1BF63741003B8749 /* GeoTrust_Global_CA-cross.cer in Resources */, + 5F4323CD1BF63741003B8749 /* GoogleInternetAuthorityG2.cer in Resources */, + 5F4323C11BF63741003B8749 /* google.com.cer in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 298D7C481BC2C7B200FD3B3E /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 298D7CC11BC2CAA100FD3B3E /* AddTrust_External_CA_Root.cer in Resources */, + 298D7CBC1BC2CA9C00FD3B3E /* foobar.com.cer in Resources */, + 298D7CB91BC2CA9800FD3B3E /* logo.png in Resources */, + 298D7CC21BC2CAA100FD3B3E /* COMODO_RSA_Certification_Authority.cer in Resources */, + 297824A41BC2D69A0041C395 /* adn_0.cer in Resources */, + 298D7CC31BC2CAA100FD3B3E /* COMODO_RSA_Domain_Validation_Secure_Server_CA.cer in Resources */, + 298D7CE41BC2CB7C00FD3B3E /* HTTPBinOrgServerTrustChain in Resources */, + 297824A81BC2D69A0041C395 /* adn_2.cer in Resources */, + 297824A61BC2D69A0041C395 /* adn_1.cer in Resources */, + 298D7CBD1BC2CA9C00FD3B3E /* NoDomains.cer in Resources */, + 298D7CE11BC2CB5A00FD3B3E /* ADNNetServerTrustChain in Resources */, + 298D7CBB1BC2CA9C00FD3B3E /* AltName.cer in Resources */, + 5F4323D61BF63CB0003B8749 /* GoogleComServerTrustChainPath1 in Resources */, + 5F4323DA1BF63CBA003B8749 /* GoogleComServerTrustChainPath2 in Resources */, + 5F4323BC1BF63741003B8749 /* Equifax_Secure_Certificate_Authority_Root.cer in Resources */, + 5F4323CE1BF63741003B8749 /* GoogleInternetAuthorityG2.cer in Resources */, + 1FE783021C5857A100A73B7C /* httpbinorg_01192017.cer in Resources */, + 5F4323DE1BF63CCC003B8749 /* GeoTrust_Global_CA_Root.cer in Resources */, + 5F4323BF1BF63741003B8749 /* GeoTrust_Global_CA-cross.cer in Resources */, + 5F4323C21BF63741003B8749 /* google.com.cer in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 299522371BBF104D00859F49 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 299522631BBF129200859F49 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 299522751BBF136400859F49 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 2987B0A01BC408A200179A4C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2987B0BD1BC408D900179A4C /* AFNetworkReachabilityManager.m in Sources */, + 2987B0BE1BC408D900179A4C /* AFSecurityPolicy.m in Sources */, + 2987B0BC1BC408D900179A4C /* AFHTTPSessionManager.m in Sources */, + 2987B0C11BC408D900179A4C /* AFURLSessionManager.m in Sources */, + 2987B0C71BC408F900179A4C /* UIProgressView+AFNetworking.m in Sources */, + 2987B0BF1BC408D900179A4C /* AFURLRequestSerialization.m in Sources */, + 2987B0C21BC408F900179A4C /* AFAutoPurgingImageCache.m in Sources */, + 2987B0C51BC408F900179A4C /* UIButton+AFNetworking.m in Sources */, + 2987B0C41BC408F900179A4C /* UIActivityIndicatorView+AFNetworking.m in Sources */, + 2987B0C01BC408D900179A4C /* AFURLResponseSerialization.m in Sources */, + 2987B0C61BC408F900179A4C /* UIImageView+AFNetworking.m in Sources */, + 2987B0C31BC408F900179A4C /* AFImageDownloader.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 2987B0AA1BC408A200179A4C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2987B0CC1BC40A7600179A4C /* AFHTTPSessionManagerTests.m in Sources */, + 2987B0E41BC40B0900179A4C /* AFUIImageViewTests.m in Sources */, + 2987B0D11BC40A7600179A4C /* AFURLSessionManagerTests.m in Sources */, + 2987B0E31BC40B0900179A4C /* AFUIActivityIndicatorViewTests.m in Sources */, + 2987B0D01BC40A7600179A4C /* AFSecurityPolicyTests.m in Sources */, + 2987B0CB1BC40A7600179A4C /* AFHTTPResponseSerializationTests.m in Sources */, + 2987B0CE1BC40A7600179A4C /* AFNetworkReachabilityManagerTests.m in Sources */, + 2987B0E01BC40B0900179A4C /* AFAutoPurgingImageCacheTests.m in Sources */, + 2987B0CA1BC40A7600179A4C /* AFHTTPRequestSerializationTests.m in Sources */, + 29D341411C20D46400A7D266 /* AFCompoundResponseSerializerTests.m in Sources */, + 2987B0E11BC40B0900179A4C /* AFImageDownloaderTests.m in Sources */, + 2987B0CF1BC40A7600179A4C /* AFPropertyListResponseSerializerTests.m in Sources */, + 2987B0D21BC40AD800179A4C /* AFTestCase.m in Sources */, + 2987B0CD1BC40A7600179A4C /* AFJSONSerializationTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 298D7C371BC2C79500FD3B3E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 29D3413F1C20D46400A7D266 /* AFCompoundResponseSerializerTests.m in Sources */, + 2960BAC31C1B2F1A00BA02F0 /* AFUIButtonTests.m in Sources */, + 298D7C961BC2C94400FD3B3E /* AFTestCase.m in Sources */, + 298D7CB11BC2CA6E00FD3B3E /* AFHTTPRequestSerializationTests.m in Sources */, + 297824AE1BC2DBD80041C395 /* AFUIActivityIndicatorViewTests.m in Sources */, + 297824AD1BC2DBA40041C395 /* AFNetworkActivityManagerTests.m in Sources */, + 298D7CDD1BC2CAF700FD3B3E /* AFSecurityPolicyTests.m in Sources */, + 298D7CD31BC2CAE800FD3B3E /* AFHTTPResponseSerializationTests.m in Sources */, + 297824B01BC2DC2D0041C395 /* AFUIImageViewTests.m in Sources */, + 297824AF1BC2DBEF0041C395 /* AFUIRefreshControlTests.m in Sources */, + 298D7CD91BC2CAF200FD3B3E /* AFNetworkReachabilityManagerTests.m in Sources */, + 297824AA1BC2DAD80041C395 /* AFAutoPurgingImageCacheTests.m in Sources */, + 298D7C981BC2CA2500FD3B3E /* AFURLSessionManagerTests.m in Sources */, + 297824AC1BC2DB450041C395 /* AFImageDownloaderTests.m in Sources */, + 29F5EF031C47E64F008B976A /* AFUIWebViewTests.m in Sources */, + 298D7CD51BC2CAEC00FD3B3E /* AFHTTPSessionManagerTests.m in Sources */, + 298D7CD71BC2CAEF00FD3B3E /* AFJSONSerializationTests.m in Sources */, + 298D7CDB1BC2CAF500FD3B3E /* AFPropertyListResponseSerializerTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 298D7C461BC2C7B200FD3B3E /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 298D7CD41BC2CAE900FD3B3E /* AFHTTPResponseSerializationTests.m in Sources */, + 29D341401C20D46400A7D266 /* AFCompoundResponseSerializerTests.m in Sources */, + 298D7CB21BC2CA6E00FD3B3E /* AFHTTPRequestSerializationTests.m in Sources */, + 298D7CDE1BC2CAF800FD3B3E /* AFSecurityPolicyTests.m in Sources */, + 298D7C971BC2C94500FD3B3E /* AFTestCase.m in Sources */, + 298D7CD81BC2CAF000FD3B3E /* AFJSONSerializationTests.m in Sources */, + 298D7CDC1BC2CAF500FD3B3E /* AFPropertyListResponseSerializerTests.m in Sources */, + 298D7CD61BC2CAED00FD3B3E /* AFHTTPSessionManagerTests.m in Sources */, + 298D7CDA1BC2CAF300FD3B3E /* AFNetworkReachabilityManagerTests.m in Sources */, + 298D7C991BC2CA2600FD3B3E /* AFURLSessionManagerTests.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 299522341BBF104D00859F49 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 299522AD1BBF13C700859F49 /* UIProgressView+AFNetworking.m in Sources */, + 299522571BBF125A00859F49 /* AFNetworkReachabilityManager.m in Sources */, + 299522AF1BBF13C700859F49 /* UIRefreshControl+AFNetworking.m in Sources */, + 299522AA1BBF13C700859F49 /* UIImageView+AFNetworking.m in Sources */, + 299522B11BBF13C700859F49 /* UIWebView+AFNetworking.m in Sources */, + 299522591BBF125A00859F49 /* AFSecurityPolicy.m in Sources */, + 299522A71BBF13C700859F49 /* UIButton+AFNetworking.m in Sources */, + 299522541BBF125A00859F49 /* AFHTTPSessionManager.m in Sources */, + 2995225F1BBF125A00859F49 /* AFURLSessionManager.m in Sources */, + 2995225B1BBF125A00859F49 /* AFURLRequestSerialization.m in Sources */, + 2995229D1BBF13C700859F49 /* AFAutoPurgingImageCache.m in Sources */, + 299522A31BBF13C700859F49 /* UIActivityIndicatorView+AFNetworking.m in Sources */, + 2995225D1BBF125A00859F49 /* AFURLResponseSerialization.m in Sources */, + 2995229F1BBF13C700859F49 /* AFImageDownloader.m in Sources */, + 299522A11BBF13C700859F49 /* AFNetworkActivityIndicatorManager.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 299522601BBF129200859F49 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 299522711BBF133400859F49 /* AFURLSessionManager.m in Sources */, + 2995226F1BBF133400859F49 /* AFURLRequestSerialization.m in Sources */, + 2995226E1BBF133400859F49 /* AFSecurityPolicy.m in Sources */, + 299522701BBF133400859F49 /* AFURLResponseSerialization.m in Sources */, + 2995226D1BBF133400859F49 /* AFHTTPSessionManager.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 299522721BBF136400859F49 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 299522801BBF13A100859F49 /* AFNetworkReachabilityManager.m in Sources */, + 299522811BBF13A100859F49 /* AFSecurityPolicy.m in Sources */, + 2995227F1BBF13A100859F49 /* AFHTTPSessionManager.m in Sources */, + 299522841BBF13A100859F49 /* AFURLSessionManager.m in Sources */, + 299522821BBF13A100859F49 /* AFURLRequestSerialization.m in Sources */, + 299522831BBF13A100859F49 /* AFURLResponseSerialization.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 2987B0B11BC408A200179A4C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 2987B0A41BC408A200179A4C /* AFNetworking tvOS */; + targetProxy = 2987B0B01BC408A200179A4C /* PBXContainerItemProxy */; + }; + 298D7C421BC2C79500FD3B3E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 299522381BBF104D00859F49 /* AFNetworking iOS */; + targetProxy = 298D7C411BC2C79500FD3B3E /* PBXContainerItemProxy */; + }; + 298D7C511BC2C7B200FD3B3E /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = 299522761BBF136400859F49 /* AFNetworking OS X */; + targetProxy = 298D7C501BC2C7B200FD3B3E /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 2987B0B61BC408A200179A4C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BITCODE_GENERATION_MODE = marker; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = ./Framework/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.alamofire.AFNetworking; + PRODUCT_NAME = AFNetworking; + SDKROOT = appletvos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; + WATCHOS_DEPLOYMENT_TARGET = 2.0; + }; + name = Debug; + }; + 2987B0B71BC408A200179A4C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BITCODE_GENERATION_MODE = bitcode; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = ./Framework/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.alamofire.AFNetworking; + PRODUCT_NAME = AFNetworking; + SDKROOT = appletvos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = 3; + TVOS_DEPLOYMENT_TARGET = 9.0; + WATCHOS_DEPLOYMENT_TARGET = 2.0; + }; + name = Release; + }; + 2987B0B81BC408A200179A4C /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + INFOPLIST_FILE = ./Tests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.AFNetworking-tvOSTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + TVOS_DEPLOYMENT_TARGET = 9.0; + }; + name = Debug; + }; + 2987B0B91BC408A200179A4C /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + INFOPLIST_FILE = ./Tests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.AFNetworking-tvOSTests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = appletvos; + TVOS_DEPLOYMENT_TARGET = 9.0; + }; + name = Release; + }; + 298D7C431BC2C79500FD3B3E /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "iPhone Developer"; + GCC_PREFIX_HEADER = "$(PROJECT_DIR)/Tests/Tests-Prefix.pch"; + INFOPLIST_FILE = ./Tests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.AFNetworking-iOS-Tests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 298D7C441BC2C79500FD3B3E /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + CODE_SIGN_IDENTITY = "iPhone Developer"; + GCC_PREFIX_HEADER = "$(PROJECT_DIR)/Tests/Tests-Prefix.pch"; + INFOPLIST_FILE = ./Tests/Info.plist; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.AFNetworking-iOS-Tests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + 298D7C531BC2C7B200FD3B3E /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + COMBINE_HIDPI_IMAGES = YES; + GCC_PREFIX_HEADER = "$(PROJECT_DIR)/Tests/Tests-Prefix.pch"; + INFOPLIST_FILE = ./Tests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.9; + PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.AFNetworking-Mac-OS-X-Tests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + }; + name = Debug; + }; + 298D7C541BC2C7B200FD3B3E /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + COMBINE_HIDPI_IMAGES = YES; + GCC_PREFIX_HEADER = "$(PROJECT_DIR)/Tests/Tests-Prefix.pch"; + INFOPLIST_FILE = ./Tests/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.9; + PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.AFNetworking-Mac-OS-X-Tests"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = macosx; + }; + name = Release; + }; + 2995223F1BBF104D00859F49 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MACOSX_DEPLOYMENT_TARGET = 10.9; + MODULEMAP_FILE = "$(PROJECT_DIR)/Framework/module.modulemap"; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + TVOS_DEPLOYMENT_TARGET = 9.0; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + WATCHOS_DEPLOYMENT_TARGET = 2.0; + }; + name = Debug; + }; + 299522401BBF104D00859F49 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + CURRENT_PROJECT_VERSION = 1; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_NS_ASSERTIONS = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_NO_COMMON_BLOCKS = YES; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MACOSX_DEPLOYMENT_TARGET = 10.9; + MODULEMAP_FILE = "$(PROJECT_DIR)/Framework/module.modulemap"; + MTL_ENABLE_DEBUG_INFO = NO; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + TVOS_DEPLOYMENT_TARGET = 9.0; + VALIDATE_PRODUCT = YES; + VERSIONING_SYSTEM = "apple-generic"; + VERSION_INFO_PREFIX = ""; + WATCHOS_DEPLOYMENT_TARGET = 2.0; + }; + name = Release; + }; + 299522421BBF104D00859F49 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BITCODE_GENERATION_MODE = marker; + CODE_SIGN_IDENTITY = "iPhone Developer"; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_WARN_SHADOW = YES; + INFOPLIST_FILE = ./Framework/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.alamofire.AFNetworking; + PRODUCT_NAME = AFNetworking; + SKIP_INSTALL = YES; + TVOS_DEPLOYMENT_TARGET = 9.0; + WATCHOS_DEPLOYMENT_TARGET = 2.0; + }; + name = Debug; + }; + 299522431BBF104D00859F49 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BITCODE_GENERATION_MODE = bitcode; + CODE_SIGN_IDENTITY = "iPhone Developer"; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + GCC_WARN_SHADOW = YES; + INFOPLIST_FILE = ./Framework/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = com.alamofire.AFNetworking; + PRODUCT_NAME = AFNetworking; + SKIP_INSTALL = YES; + TVOS_DEPLOYMENT_TARGET = 9.0; + WATCHOS_DEPLOYMENT_TARGET = 2.0; + }; + name = Release; + }; + 2995226B1BBF129200859F49 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BITCODE_GENERATION_MODE = marker; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = ./Framework/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.AFNetworking-watchOS"; + PRODUCT_NAME = AFNetworking; + SDKROOT = watchos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = 4; + TVOS_DEPLOYMENT_TARGET = 9.0; + WATCHOS_DEPLOYMENT_TARGET = 2.0; + }; + name = Debug; + }; + 2995226C1BBF129200859F49 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BITCODE_GENERATION_MODE = bitcode; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + INFOPLIST_FILE = ./Framework/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"; + PRODUCT_BUNDLE_IDENTIFIER = "com.alamofire.AFNetworking-watchOS"; + PRODUCT_NAME = AFNetworking; + SDKROOT = watchos; + SKIP_INSTALL = YES; + TARGETED_DEVICE_FAMILY = 4; + TVOS_DEPLOYMENT_TARGET = 9.0; + WATCHOS_DEPLOYMENT_TARGET = 2.0; + }; + name = Release; + }; + 2995227D1BBF136400859F49 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + BITCODE_GENERATION_MODE = marker; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + COMBINE_HIDPI_IMAGES = YES; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_VERSION = A; + INFOPLIST_FILE = ./Framework/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.9; + PRODUCT_BUNDLE_IDENTIFIER = com.alamofire.AFNetworking; + PRODUCT_NAME = AFNetworking; + SDKROOT = macosx; + SKIP_INSTALL = YES; + TVOS_DEPLOYMENT_TARGET = 9.0; + WATCHOS_DEPLOYMENT_TARGET = 2.0; + }; + name = Debug; + }; + 2995227E1BBF136400859F49 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + BITCODE_GENERATION_MODE = bitcode; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + COMBINE_HIDPI_IMAGES = YES; + DEFINES_MODULE = YES; + DYLIB_COMPATIBILITY_VERSION = 1; + DYLIB_CURRENT_VERSION = 1; + DYLIB_INSTALL_NAME_BASE = "@rpath"; + FRAMEWORK_VERSION = A; + INFOPLIST_FILE = ./Framework/Info.plist; + INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks"; + MACOSX_DEPLOYMENT_TARGET = 10.9; + PRODUCT_BUNDLE_IDENTIFIER = com.alamofire.AFNetworking; + PRODUCT_NAME = AFNetworking; + SDKROOT = macosx; + SKIP_INSTALL = YES; + TVOS_DEPLOYMENT_TARGET = 9.0; + WATCHOS_DEPLOYMENT_TARGET = 2.0; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 2987B0BA1BC408A200179A4C /* Build configuration list for PBXNativeTarget "AFNetworking tvOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2987B0B61BC408A200179A4C /* Debug */, + 2987B0B71BC408A200179A4C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2987B0BB1BC408A200179A4C /* Build configuration list for PBXNativeTarget "AFNetworking tvOS Tests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2987B0B81BC408A200179A4C /* Debug */, + 2987B0B91BC408A200179A4C /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 298D7C451BC2C79600FD3B3E /* Build configuration list for PBXNativeTarget "AFNetworking iOS Tests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 298D7C431BC2C79500FD3B3E /* Debug */, + 298D7C441BC2C79500FD3B3E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 298D7C521BC2C7B200FD3B3E /* Build configuration list for PBXNativeTarget "AFNetworking Mac OS X Tests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 298D7C531BC2C7B200FD3B3E /* Debug */, + 298D7C541BC2C7B200FD3B3E /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 299522331BBF104D00859F49 /* Build configuration list for PBXProject "AFNetworking" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2995223F1BBF104D00859F49 /* Debug */, + 299522401BBF104D00859F49 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 299522411BBF104D00859F49 /* Build configuration list for PBXNativeTarget "AFNetworking iOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 299522421BBF104D00859F49 /* Debug */, + 299522431BBF104D00859F49 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2995226A1BBF129200859F49 /* Build configuration list for PBXNativeTarget "AFNetworking watchOS" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2995226B1BBF129200859F49 /* Debug */, + 2995226C1BBF129200859F49 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2995227C1BBF136400859F49 /* Build configuration list for PBXNativeTarget "AFNetworking OS X" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 2995227D1BBF136400859F49 /* Debug */, + 2995227E1BBF136400859F49 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 299522301BBF104D00859F49 /* Project object */; +} diff --git a/its/plugin/projects/AFNetworking/AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking OS X.xcscheme b/its/plugin/projects/AFNetworking/AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking OS X.xcscheme new file mode 100644 index 00000000..04cfe1e6 --- /dev/null +++ b/its/plugin/projects/AFNetworking/AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking OS X.xcscheme @@ -0,0 +1,105 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/its/plugin/projects/AFNetworking/AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking iOS.xcscheme b/its/plugin/projects/AFNetworking/AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking iOS.xcscheme new file mode 100644 index 00000000..e4eb272f --- /dev/null +++ b/its/plugin/projects/AFNetworking/AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking iOS.xcscheme @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/its/plugin/projects/AFNetworking/AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking tvOS.xcscheme b/its/plugin/projects/AFNetworking/AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking tvOS.xcscheme new file mode 100644 index 00000000..23072b32 --- /dev/null +++ b/its/plugin/projects/AFNetworking/AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking tvOS.xcscheme @@ -0,0 +1,104 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/its/plugin/projects/AFNetworking/AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking watchOS.xcscheme b/its/plugin/projects/AFNetworking/AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking watchOS.xcscheme new file mode 100644 index 00000000..7f3f3ef6 --- /dev/null +++ b/its/plugin/projects/AFNetworking/AFNetworking.xcodeproj/xcshareddata/xcschemes/AFNetworking watchOS.xcscheme @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/its/plugin/projects/AFNetworking/AFNetworking/AFHTTPSessionManager.h b/its/plugin/projects/AFNetworking/AFNetworking/AFHTTPSessionManager.h new file mode 100644 index 00000000..61e1042c --- /dev/null +++ b/its/plugin/projects/AFNetworking/AFNetworking/AFHTTPSessionManager.h @@ -0,0 +1,295 @@ +// AFHTTPSessionManager.h +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import +#if !TARGET_OS_WATCH +#import +#endif +#import + +#if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV +#import +#else +#import +#endif + +#import "AFURLSessionManager.h" + +/** + `AFHTTPSessionManager` is a subclass of `AFURLSessionManager` with convenience methods for making HTTP requests. When a `baseURL` is provided, requests made with the `GET` / `POST` / et al. convenience methods can be made with relative paths. + + ## Subclassing Notes + + Developers targeting iOS 7 or Mac OS X 10.9 or later that deal extensively with a web service are encouraged to subclass `AFHTTPSessionManager`, providing a class method that returns a shared singleton object on which authentication and other configuration can be shared across the application. + + For developers targeting iOS 6 or Mac OS X 10.8 or earlier, `AFHTTPRequestOperationManager` may be used to similar effect. + + ## Methods to Override + + To change the behavior of all data task operation construction, which is also used in the `GET` / `POST` / et al. convenience methods, override `dataTaskWithRequest:completionHandler:`. + + ## Serialization + + Requests created by an HTTP client will contain default headers and encode parameters according to the `requestSerializer` property, which is an object conforming to ``. + + Responses received from the server are automatically validated and serialized by the `responseSerializers` property, which is an object conforming to `` + + ## URL Construction Using Relative Paths + + For HTTP convenience methods, the request serializer constructs URLs from the path relative to the `-baseURL`, using `NSURL +URLWithString:relativeToURL:`, when provided. If `baseURL` is `nil`, `path` needs to resolve to a valid `NSURL` object using `NSURL +URLWithString:`. + + Below are a few examples of how `baseURL` and relative paths interact: + + NSURL *baseURL = [NSURL URLWithString:@"http://example.com/v1/"]; + [NSURL URLWithString:@"foo" relativeToURL:baseURL]; // http://example.com/v1/foo + [NSURL URLWithString:@"foo?bar=baz" relativeToURL:baseURL]; // http://example.com/v1/foo?bar=baz + [NSURL URLWithString:@"/foo" relativeToURL:baseURL]; // http://example.com/foo + [NSURL URLWithString:@"foo/" relativeToURL:baseURL]; // http://example.com/v1/foo + [NSURL URLWithString:@"/foo/" relativeToURL:baseURL]; // http://example.com/foo/ + [NSURL URLWithString:@"http://example2.com/" relativeToURL:baseURL]; // http://example2.com/ + + Also important to note is that a trailing slash will be added to any `baseURL` without one. This would otherwise cause unexpected behavior when constructing URLs using paths without a leading slash. + + @warning Managers for background sessions must be owned for the duration of their use. This can be accomplished by creating an application-wide or shared singleton instance. + */ + +NS_ASSUME_NONNULL_BEGIN + +@interface AFHTTPSessionManager : AFURLSessionManager + +/** + The URL used to construct requests from relative paths in methods like `requestWithMethod:URLString:parameters:`, and the `GET` / `POST` / et al. convenience methods. + */ +@property (readonly, nonatomic, strong, nullable) NSURL *baseURL; + +/** + Requests created with `requestWithMethod:URLString:parameters:` & `multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:` are constructed with a set of default headers using a parameter serialization specified by this property. By default, this is set to an instance of `AFHTTPRequestSerializer`, which serializes query string parameters for `GET`, `HEAD`, and `DELETE` requests, or otherwise URL-form-encodes HTTP message bodies. + + @warning `requestSerializer` must not be `nil`. + */ +@property (nonatomic, strong) AFHTTPRequestSerializer * requestSerializer; + +/** + Responses sent from the server in data tasks created with `dataTaskWithRequest:success:failure:` and run using the `GET` / `POST` / et al. convenience methods are automatically validated and serialized by the response serializer. By default, this property is set to an instance of `AFJSONResponseSerializer`. + + @warning `responseSerializer` must not be `nil`. + */ +@property (nonatomic, strong) AFHTTPResponseSerializer * responseSerializer; + +///--------------------- +/// @name Initialization +///--------------------- + +/** + Creates and returns an `AFHTTPSessionManager` object. + */ ++ (instancetype)manager; + +/** + Initializes an `AFHTTPSessionManager` object with the specified base URL. + + @param url The base URL for the HTTP client. + + @return The newly-initialized HTTP client + */ +- (instancetype)initWithBaseURL:(nullable NSURL *)url; + +/** + Initializes an `AFHTTPSessionManager` object with the specified base URL. + + This is the designated initializer. + + @param url The base URL for the HTTP client. + @param configuration The configuration used to create the managed session. + + @return The newly-initialized HTTP client + */ +- (instancetype)initWithBaseURL:(nullable NSURL *)url + sessionConfiguration:(nullable NSURLSessionConfiguration *)configuration NS_DESIGNATED_INITIALIZER; + +///--------------------------- +/// @name Making HTTP Requests +///--------------------------- + +/** + Creates and runs an `NSURLSessionDataTask` with a `GET` request. + + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be encoded according to the client request serializer. + @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. + @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. + + @see -dataTaskWithRequest:completionHandler: + */ +- (nullable NSURLSessionDataTask *)GET:(NSString *)URLString + parameters:(nullable id)parameters + success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success + failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE; + + +/** + Creates and runs an `NSURLSessionDataTask` with a `GET` request. + + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be encoded according to the client request serializer. + @param progress A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue. + @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. + @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. + + @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler: + */ +- (nullable NSURLSessionDataTask *)GET:(NSString *)URLString + parameters:(nullable id)parameters + progress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgress + success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success + failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; + +/** + Creates and runs an `NSURLSessionDataTask` with a `HEAD` request. + + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be encoded according to the client request serializer. + @param success A block object to be executed when the task finishes successfully. This block has no return value and takes a single arguments: the data task. + @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. + + @see -dataTaskWithRequest:completionHandler: + */ +- (nullable NSURLSessionDataTask *)HEAD:(NSString *)URLString + parameters:(nullable id)parameters + success:(nullable void (^)(NSURLSessionDataTask *task))success + failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; + +/** + Creates and runs an `NSURLSessionDataTask` with a `POST` request. + + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be encoded according to the client request serializer. + @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. + @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. + + @see -dataTaskWithRequest:completionHandler: + */ +- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString + parameters:(nullable id)parameters + success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success + failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE; + +/** + Creates and runs an `NSURLSessionDataTask` with a `POST` request. + + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be encoded according to the client request serializer. + @param progress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. + @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. + @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. + + @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler: + */ +- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString + parameters:(nullable id)parameters + progress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgress + success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success + failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; + +/** + Creates and runs an `NSURLSessionDataTask` with a multipart `POST` request. + + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be encoded according to the client request serializer. + @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol. + @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. + @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. + + @see -dataTaskWithRequest:completionHandler: + */ +- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString + parameters:(nullable id)parameters + constructingBodyWithBlock:(nullable void (^)(id formData))block + success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success + failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE; + +/** + Creates and runs an `NSURLSessionDataTask` with a multipart `POST` request. + + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be encoded according to the client request serializer. + @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol. + @param progress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. + @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. + @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. + + @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler: + */ +- (nullable NSURLSessionDataTask *)POST:(NSString *)URLString + parameters:(nullable id)parameters + constructingBodyWithBlock:(nullable void (^)(id formData))block + progress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgress + success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success + failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; + +/** + Creates and runs an `NSURLSessionDataTask` with a `PUT` request. + + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be encoded according to the client request serializer. + @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. + @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. + + @see -dataTaskWithRequest:completionHandler: + */ +- (nullable NSURLSessionDataTask *)PUT:(NSString *)URLString + parameters:(nullable id)parameters + success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success + failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; + +/** + Creates and runs an `NSURLSessionDataTask` with a `PATCH` request. + + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be encoded according to the client request serializer. + @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. + @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. + + @see -dataTaskWithRequest:completionHandler: + */ +- (nullable NSURLSessionDataTask *)PATCH:(NSString *)URLString + parameters:(nullable id)parameters + success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success + failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; + +/** + Creates and runs an `NSURLSessionDataTask` with a `DELETE` request. + + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be encoded according to the client request serializer. + @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. + @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. + + @see -dataTaskWithRequest:completionHandler: + */ +- (nullable NSURLSessionDataTask *)DELETE:(NSString *)URLString + parameters:(nullable id)parameters + success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success + failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; + +@end + +NS_ASSUME_NONNULL_END diff --git a/its/plugin/projects/AFNetworking/AFNetworking/AFHTTPSessionManager.m b/its/plugin/projects/AFNetworking/AFNetworking/AFHTTPSessionManager.m new file mode 100644 index 00000000..249631bc --- /dev/null +++ b/its/plugin/projects/AFNetworking/AFNetworking/AFHTTPSessionManager.m @@ -0,0 +1,361 @@ +// AFHTTPSessionManager.m +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "AFHTTPSessionManager.h" + +#import "AFURLRequestSerialization.h" +#import "AFURLResponseSerialization.h" + +#import +#import +#import + +#import +#import +#import +#import +#import + +#if TARGET_OS_IOS || TARGET_OS_TV +#import +#elif TARGET_OS_WATCH +#import +#endif + +@interface AFHTTPSessionManager () +@property (readwrite, nonatomic, strong) NSURL *baseURL; +@end + +@implementation AFHTTPSessionManager +@dynamic responseSerializer; + ++ (instancetype)manager { + return [[[self class] alloc] initWithBaseURL:nil]; +} + +- (instancetype)init { + return [self initWithBaseURL:nil]; +} + +- (instancetype)initWithBaseURL:(NSURL *)url { + return [self initWithBaseURL:url sessionConfiguration:nil]; +} + +- (instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)configuration { + return [self initWithBaseURL:nil sessionConfiguration:configuration]; +} + +- (instancetype)initWithBaseURL:(NSURL *)url + sessionConfiguration:(NSURLSessionConfiguration *)configuration +{ + self = [super initWithSessionConfiguration:configuration]; + if (!self) { + return nil; + } + + // Ensure terminal slash for baseURL path, so that NSURL +URLWithString:relativeToURL: works as expected + if ([[url path] length] > 0 && ![[url absoluteString] hasSuffix:@"/"]) { + url = [url URLByAppendingPathComponent:@""]; + } + + self.baseURL = url; + + self.requestSerializer = [AFHTTPRequestSerializer serializer]; + self.responseSerializer = [AFJSONResponseSerializer serializer]; + + return self; +} + +#pragma mark - + +- (void)setRequestSerializer:(AFHTTPRequestSerializer *)requestSerializer { + NSParameterAssert(requestSerializer); + + _requestSerializer = requestSerializer; +} + +- (void)setResponseSerializer:(AFHTTPResponseSerializer *)responseSerializer { + NSParameterAssert(responseSerializer); + + [super setResponseSerializer:responseSerializer]; +} + +#pragma mark - + +- (NSURLSessionDataTask *)GET:(NSString *)URLString + parameters:(id)parameters + success:(void (^)(NSURLSessionDataTask *task, id responseObject))success + failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure +{ + + return [self GET:URLString parameters:parameters progress:nil success:success failure:failure]; +} + +- (NSURLSessionDataTask *)GET:(NSString *)URLString + parameters:(id)parameters + progress:(void (^)(NSProgress * _Nonnull))downloadProgress + success:(void (^)(NSURLSessionDataTask * _Nonnull, id _Nullable))success + failure:(void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure +{ + + NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"GET" + URLString:URLString + parameters:parameters + uploadProgress:nil + downloadProgress:downloadProgress + success:success + failure:failure]; + + [dataTask resume]; + + return dataTask; +} + +- (NSURLSessionDataTask *)HEAD:(NSString *)URLString + parameters:(id)parameters + success:(void (^)(NSURLSessionDataTask *task))success + failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure +{ + NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"HEAD" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:^(NSURLSessionDataTask *task, __unused id responseObject) { + if (success) { + success(task); + } + } failure:failure]; + + [dataTask resume]; + + return dataTask; +} + +- (NSURLSessionDataTask *)POST:(NSString *)URLString + parameters:(id)parameters + success:(void (^)(NSURLSessionDataTask *task, id responseObject))success + failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure +{ + return [self POST:URLString parameters:parameters progress:nil success:success failure:failure]; +} + +- (NSURLSessionDataTask *)POST:(NSString *)URLString + parameters:(id)parameters + progress:(void (^)(NSProgress * _Nonnull))uploadProgress + success:(void (^)(NSURLSessionDataTask * _Nonnull, id _Nullable))success + failure:(void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure +{ + NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"POST" URLString:URLString parameters:parameters uploadProgress:uploadProgress downloadProgress:nil success:success failure:failure]; + + [dataTask resume]; + + return dataTask; +} + +- (NSURLSessionDataTask *)POST:(NSString *)URLString + parameters:(nullable id)parameters + constructingBodyWithBlock:(nullable void (^)(id _Nonnull))block + success:(nullable void (^)(NSURLSessionDataTask * _Nonnull, id _Nullable))success + failure:(nullable void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure +{ + return [self POST:URLString parameters:parameters constructingBodyWithBlock:block progress:nil success:success failure:failure]; +} + +- (NSURLSessionDataTask *)POST:(NSString *)URLString + parameters:(id)parameters + constructingBodyWithBlock:(void (^)(id formData))block + progress:(nullable void (^)(NSProgress * _Nonnull))uploadProgress + success:(void (^)(NSURLSessionDataTask *task, id responseObject))success + failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure +{ + NSError *serializationError = nil; + NSMutableURLRequest *request = [self.requestSerializer multipartFormRequestWithMethod:@"POST" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters constructingBodyWithBlock:block error:&serializationError]; + if (serializationError) { + if (failure) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu" + dispatch_async(self.completionQueue ?: dispatch_get_main_queue(), ^{ + failure(nil, serializationError); + }); +#pragma clang diagnostic pop + } + + return nil; + } + + __block NSURLSessionDataTask *task = [self uploadTaskWithStreamedRequest:request progress:uploadProgress completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) { + if (error) { + if (failure) { + failure(task, error); + } + } else { + if (success) { + success(task, responseObject); + } + } + }]; + + [task resume]; + + return task; +} + +- (NSURLSessionDataTask *)PUT:(NSString *)URLString + parameters:(id)parameters + success:(void (^)(NSURLSessionDataTask *task, id responseObject))success + failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure +{ + NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"PUT" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:success failure:failure]; + + [dataTask resume]; + + return dataTask; +} + +- (NSURLSessionDataTask *)PATCH:(NSString *)URLString + parameters:(id)parameters + success:(void (^)(NSURLSessionDataTask *task, id responseObject))success + failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure +{ + NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"PATCH" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:success failure:failure]; + + [dataTask resume]; + + return dataTask; +} + +- (NSURLSessionDataTask *)DELETE:(NSString *)URLString + parameters:(id)parameters + success:(void (^)(NSURLSessionDataTask *task, id responseObject))success + failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure +{ + NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"DELETE" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:success failure:failure]; + + [dataTask resume]; + + return dataTask; +} + +- (NSURLSessionDataTask *)dataTaskWithHTTPMethod:(NSString *)method + URLString:(NSString *)URLString + parameters:(id)parameters + uploadProgress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgress + downloadProgress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgress + success:(void (^)(NSURLSessionDataTask *, id))success + failure:(void (^)(NSURLSessionDataTask *, NSError *))failure +{ + NSError *serializationError = nil; + NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:method URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters error:&serializationError]; + if (serializationError) { + if (failure) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu" + dispatch_async(self.completionQueue ?: dispatch_get_main_queue(), ^{ + failure(nil, serializationError); + }); +#pragma clang diagnostic pop + } + + return nil; + } + + __block NSURLSessionDataTask *dataTask = nil; + dataTask = [self dataTaskWithRequest:request + uploadProgress:uploadProgress + downloadProgress:downloadProgress + completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) { + if (error) { + if (failure) { + failure(dataTask, error); + } + } else { + if (success) { + success(dataTask, responseObject); + } + } + }]; + + return dataTask; +} + +#pragma mark - NSObject + +- (NSString *)description { + return [NSString stringWithFormat:@"<%@: %p, baseURL: %@, session: %@, operationQueue: %@>", NSStringFromClass([self class]), self, [self.baseURL absoluteString], self.session, self.operationQueue]; +} + +#pragma mark - NSSecureCoding + ++ (BOOL)supportsSecureCoding { + return YES; +} + +- (instancetype)initWithCoder:(NSCoder *)decoder { + NSURL *baseURL = [decoder decodeObjectOfClass:[NSURL class] forKey:NSStringFromSelector(@selector(baseURL))]; + NSURLSessionConfiguration *configuration = [decoder decodeObjectOfClass:[NSURLSessionConfiguration class] forKey:@"sessionConfiguration"]; + if (!configuration) { + NSString *configurationIdentifier = [decoder decodeObjectOfClass:[NSString class] forKey:@"identifier"]; + if (configurationIdentifier) { +#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1100) + configuration = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:configurationIdentifier]; +#else + configuration = [NSURLSessionConfiguration backgroundSessionConfiguration:configurationIdentifier]; +#endif + } + } + + self = [self initWithBaseURL:baseURL sessionConfiguration:configuration]; + if (!self) { + return nil; + } + + self.requestSerializer = [decoder decodeObjectOfClass:[AFHTTPRequestSerializer class] forKey:NSStringFromSelector(@selector(requestSerializer))]; + self.responseSerializer = [decoder decodeObjectOfClass:[AFHTTPResponseSerializer class] forKey:NSStringFromSelector(@selector(responseSerializer))]; + AFSecurityPolicy *decodedPolicy = [decoder decodeObjectOfClass:[AFSecurityPolicy class] forKey:NSStringFromSelector(@selector(securityPolicy))]; + if (decodedPolicy) { + self.securityPolicy = decodedPolicy; + } + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)coder { + [super encodeWithCoder:coder]; + + [coder encodeObject:self.baseURL forKey:NSStringFromSelector(@selector(baseURL))]; + if ([self.session.configuration conformsToProtocol:@protocol(NSCoding)]) { + [coder encodeObject:self.session.configuration forKey:@"sessionConfiguration"]; + } else { + [coder encodeObject:self.session.configuration.identifier forKey:@"identifier"]; + } + [coder encodeObject:self.requestSerializer forKey:NSStringFromSelector(@selector(requestSerializer))]; + [coder encodeObject:self.responseSerializer forKey:NSStringFromSelector(@selector(responseSerializer))]; + [coder encodeObject:self.securityPolicy forKey:NSStringFromSelector(@selector(securityPolicy))]; +} + +#pragma mark - NSCopying + +- (instancetype)copyWithZone:(NSZone *)zone { + AFHTTPSessionManager *HTTPClient = [[[self class] allocWithZone:zone] initWithBaseURL:self.baseURL sessionConfiguration:self.session.configuration]; + + HTTPClient.requestSerializer = [self.requestSerializer copyWithZone:zone]; + HTTPClient.responseSerializer = [self.responseSerializer copyWithZone:zone]; + HTTPClient.securityPolicy = [self.securityPolicy copyWithZone:zone]; + return HTTPClient; +} + +@end diff --git a/its/plugin/projects/AFNetworking/AFNetworking/AFNetworkReachabilityManager.h b/its/plugin/projects/AFNetworking/AFNetworking/AFNetworkReachabilityManager.h new file mode 100644 index 00000000..88d9181f --- /dev/null +++ b/its/plugin/projects/AFNetworking/AFNetworking/AFNetworkReachabilityManager.h @@ -0,0 +1,206 @@ +// AFNetworkReachabilityManager.h +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import + +#if !TARGET_OS_WATCH +#import + +typedef NS_ENUM(NSInteger, AFNetworkReachabilityStatus) { + AFNetworkReachabilityStatusUnknown = -1, + AFNetworkReachabilityStatusNotReachable = 0, + AFNetworkReachabilityStatusReachableViaWWAN = 1, + AFNetworkReachabilityStatusReachableViaWiFi = 2, +}; + +NS_ASSUME_NONNULL_BEGIN + +/** + `AFNetworkReachabilityManager` monitors the reachability of domains, and addresses for both WWAN and WiFi network interfaces. + + Reachability can be used to determine background information about why a network operation failed, or to trigger a network operation retrying when a connection is established. It should not be used to prevent a user from initiating a network request, as it's possible that an initial request may be required to establish reachability. + + See Apple's Reachability Sample Code (https://developer.apple.com/library/ios/samplecode/reachability/) + + @warning Instances of `AFNetworkReachabilityManager` must be started with `-startMonitoring` before reachability status can be determined. + */ +@interface AFNetworkReachabilityManager : NSObject + +/** + The current network reachability status. + */ +@property (readonly, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus; + +/** + Whether or not the network is currently reachable. + */ +@property (readonly, nonatomic, assign, getter = isReachable) BOOL reachable; + +/** + Whether or not the network is currently reachable via WWAN. + */ +@property (readonly, nonatomic, assign, getter = isReachableViaWWAN) BOOL reachableViaWWAN; + +/** + Whether or not the network is currently reachable via WiFi. + */ +@property (readonly, nonatomic, assign, getter = isReachableViaWiFi) BOOL reachableViaWiFi; + +///--------------------- +/// @name Initialization +///--------------------- + +/** + Returns the shared network reachability manager. + */ ++ (instancetype)sharedManager; + +/** + Creates and returns a network reachability manager with the default socket address. + + @return An initialized network reachability manager, actively monitoring the default socket address. + */ ++ (instancetype)manager; + +/** + Creates and returns a network reachability manager for the specified domain. + + @param domain The domain used to evaluate network reachability. + + @return An initialized network reachability manager, actively monitoring the specified domain. + */ ++ (instancetype)managerForDomain:(NSString *)domain; + +/** + Creates and returns a network reachability manager for the socket address. + + @param address The socket address (`sockaddr_in6`) used to evaluate network reachability. + + @return An initialized network reachability manager, actively monitoring the specified socket address. + */ ++ (instancetype)managerForAddress:(const void *)address; + +/** + Initializes an instance of a network reachability manager from the specified reachability object. + + @param reachability The reachability object to monitor. + + @return An initialized network reachability manager, actively monitoring the specified reachability. + */ +- (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability NS_DESIGNATED_INITIALIZER; + +///-------------------------------------------------- +/// @name Starting & Stopping Reachability Monitoring +///-------------------------------------------------- + +/** + Starts monitoring for changes in network reachability status. + */ +- (void)startMonitoring; + +/** + Stops monitoring for changes in network reachability status. + */ +- (void)stopMonitoring; + +///------------------------------------------------- +/// @name Getting Localized Reachability Description +///------------------------------------------------- + +/** + Returns a localized string representation of the current network reachability status. + */ +- (NSString *)localizedNetworkReachabilityStatusString; + +///--------------------------------------------------- +/// @name Setting Network Reachability Change Callback +///--------------------------------------------------- + +/** + Sets a callback to be executed when the network availability of the `baseURL` host changes. + + @param block A block object to be executed when the network availability of the `baseURL` host changes.. This block has no return value and takes a single argument which represents the various reachability states from the device to the `baseURL`. + */ +- (void)setReachabilityStatusChangeBlock:(nullable void (^)(AFNetworkReachabilityStatus status))block; + +@end + +///---------------- +/// @name Constants +///---------------- + +/** + ## Network Reachability + + The following constants are provided by `AFNetworkReachabilityManager` as possible network reachability statuses. + + enum { + AFNetworkReachabilityStatusUnknown, + AFNetworkReachabilityStatusNotReachable, + AFNetworkReachabilityStatusReachableViaWWAN, + AFNetworkReachabilityStatusReachableViaWiFi, + } + + `AFNetworkReachabilityStatusUnknown` + The `baseURL` host reachability is not known. + + `AFNetworkReachabilityStatusNotReachable` + The `baseURL` host cannot be reached. + + `AFNetworkReachabilityStatusReachableViaWWAN` + The `baseURL` host can be reached via a cellular connection, such as EDGE or GPRS. + + `AFNetworkReachabilityStatusReachableViaWiFi` + The `baseURL` host can be reached via a Wi-Fi connection. + + ### Keys for Notification UserInfo Dictionary + + Strings that are used as keys in a `userInfo` dictionary in a network reachability status change notification. + + `AFNetworkingReachabilityNotificationStatusItem` + A key in the userInfo dictionary in a `AFNetworkingReachabilityDidChangeNotification` notification. + The corresponding value is an `NSNumber` object representing the `AFNetworkReachabilityStatus` value for the current reachability status. + */ + +///-------------------- +/// @name Notifications +///-------------------- + +/** + Posted when network reachability changes. + This notification assigns no notification object. The `userInfo` dictionary contains an `NSNumber` object under the `AFNetworkingReachabilityNotificationStatusItem` key, representing the `AFNetworkReachabilityStatus` value for the current network reachability. + + @warning In order for network reachability to be monitored, include the `SystemConfiguration` framework in the active target's "Link Binary With Library" build phase, and add `#import ` to the header prefix of the project (`Prefix.pch`). + */ +FOUNDATION_EXPORT NSString * const AFNetworkingReachabilityDidChangeNotification; +FOUNDATION_EXPORT NSString * const AFNetworkingReachabilityNotificationStatusItem; + +///-------------------- +/// @name Functions +///-------------------- + +/** + Returns a localized string representation of an `AFNetworkReachabilityStatus` value. + */ +FOUNDATION_EXPORT NSString * AFStringFromNetworkReachabilityStatus(AFNetworkReachabilityStatus status); + +NS_ASSUME_NONNULL_END +#endif diff --git a/its/plugin/projects/AFNetworking/AFNetworking/AFNetworkReachabilityManager.m b/its/plugin/projects/AFNetworking/AFNetworking/AFNetworkReachabilityManager.m new file mode 100644 index 00000000..d39b81bc --- /dev/null +++ b/its/plugin/projects/AFNetworking/AFNetworking/AFNetworkReachabilityManager.m @@ -0,0 +1,263 @@ +// AFNetworkReachabilityManager.m +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "AFNetworkReachabilityManager.h" +#if !TARGET_OS_WATCH + +#import +#import +#import +#import +#import + +NSString * const AFNetworkingReachabilityDidChangeNotification = @"com.alamofire.networking.reachability.change"; +NSString * const AFNetworkingReachabilityNotificationStatusItem = @"AFNetworkingReachabilityNotificationStatusItem"; + +typedef void (^AFNetworkReachabilityStatusBlock)(AFNetworkReachabilityStatus status); + +NSString * AFStringFromNetworkReachabilityStatus(AFNetworkReachabilityStatus status) { + switch (status) { + case AFNetworkReachabilityStatusNotReachable: + return NSLocalizedStringFromTable(@"Not Reachable", @"AFNetworking", nil); + case AFNetworkReachabilityStatusReachableViaWWAN: + return NSLocalizedStringFromTable(@"Reachable via WWAN", @"AFNetworking", nil); + case AFNetworkReachabilityStatusReachableViaWiFi: + return NSLocalizedStringFromTable(@"Reachable via WiFi", @"AFNetworking", nil); + case AFNetworkReachabilityStatusUnknown: + default: + return NSLocalizedStringFromTable(@"Unknown", @"AFNetworking", nil); + } +} + +static AFNetworkReachabilityStatus AFNetworkReachabilityStatusForFlags(SCNetworkReachabilityFlags flags) { + BOOL isReachable = ((flags & kSCNetworkReachabilityFlagsReachable) != 0); + BOOL needsConnection = ((flags & kSCNetworkReachabilityFlagsConnectionRequired) != 0); + BOOL canConnectionAutomatically = (((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) || ((flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0)); + BOOL canConnectWithoutUserInteraction = (canConnectionAutomatically && (flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0); + BOOL isNetworkReachable = (isReachable && (!needsConnection || canConnectWithoutUserInteraction)); + + AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusUnknown; + if (isNetworkReachable == NO) { + status = AFNetworkReachabilityStatusNotReachable; + } +#if TARGET_OS_IPHONE + else if ((flags & kSCNetworkReachabilityFlagsIsWWAN) != 0) { + status = AFNetworkReachabilityStatusReachableViaWWAN; + } +#endif + else { + status = AFNetworkReachabilityStatusReachableViaWiFi; + } + + return status; +} + +/** + * Queue a status change notification for the main thread. + * + * This is done to ensure that the notifications are received in the same order + * as they are sent. If notifications are sent directly, it is possible that + * a queued notification (for an earlier status condition) is processed after + * the later update, resulting in the listener being left in the wrong state. + */ +static void AFPostReachabilityStatusChange(SCNetworkReachabilityFlags flags, AFNetworkReachabilityStatusBlock block) { + AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusForFlags(flags); + dispatch_async(dispatch_get_main_queue(), ^{ + if (block) { + block(status); + } + NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; + NSDictionary *userInfo = @{ AFNetworkingReachabilityNotificationStatusItem: @(status) }; + [notificationCenter postNotificationName:AFNetworkingReachabilityDidChangeNotification object:nil userInfo:userInfo]; + }); +} + +static void AFNetworkReachabilityCallback(SCNetworkReachabilityRef __unused target, SCNetworkReachabilityFlags flags, void *info) { + AFPostReachabilityStatusChange(flags, (__bridge AFNetworkReachabilityStatusBlock)info); +} + + +static const void * AFNetworkReachabilityRetainCallback(const void *info) { + return Block_copy(info); +} + +static void AFNetworkReachabilityReleaseCallback(const void *info) { + if (info) { + Block_release(info); + } +} + +@interface AFNetworkReachabilityManager () +@property (readonly, nonatomic, assign) SCNetworkReachabilityRef networkReachability; +@property (readwrite, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus; +@property (readwrite, nonatomic, copy) AFNetworkReachabilityStatusBlock networkReachabilityStatusBlock; +@end + +@implementation AFNetworkReachabilityManager + ++ (instancetype)sharedManager { + static AFNetworkReachabilityManager *_sharedManager = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + _sharedManager = [self manager]; + }); + + return _sharedManager; +} + ++ (instancetype)managerForDomain:(NSString *)domain { + SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, [domain UTF8String]); + + AFNetworkReachabilityManager *manager = [[self alloc] initWithReachability:reachability]; + + CFRelease(reachability); + + return manager; +} + ++ (instancetype)managerForAddress:(const void *)address { + SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr *)address); + AFNetworkReachabilityManager *manager = [[self alloc] initWithReachability:reachability]; + + CFRelease(reachability); + + return manager; +} + ++ (instancetype)manager +{ +#if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) + struct sockaddr_in6 address; + bzero(&address, sizeof(address)); + address.sin6_len = sizeof(address); + address.sin6_family = AF_INET6; +#else + struct sockaddr_in address; + bzero(&address, sizeof(address)); + address.sin_len = sizeof(address); + address.sin_family = AF_INET; +#endif + return [self managerForAddress:&address]; +} + +- (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability { + self = [super init]; + if (!self) { + return nil; + } + + _networkReachability = CFRetain(reachability); + self.networkReachabilityStatus = AFNetworkReachabilityStatusUnknown; + + return self; +} + +- (instancetype)init NS_UNAVAILABLE +{ + return nil; +} + +- (void)dealloc { + [self stopMonitoring]; + + if (_networkReachability != NULL) { + CFRelease(_networkReachability); + } +} + +#pragma mark - + +- (BOOL)isReachable { + return [self isReachableViaWWAN] || [self isReachableViaWiFi]; +} + +- (BOOL)isReachableViaWWAN { + return self.networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWWAN; +} + +- (BOOL)isReachableViaWiFi { + return self.networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWiFi; +} + +#pragma mark - + +- (void)startMonitoring { + [self stopMonitoring]; + + if (!self.networkReachability) { + return; + } + + __weak __typeof(self)weakSelf = self; + AFNetworkReachabilityStatusBlock callback = ^(AFNetworkReachabilityStatus status) { + __strong __typeof(weakSelf)strongSelf = weakSelf; + + strongSelf.networkReachabilityStatus = status; + if (strongSelf.networkReachabilityStatusBlock) { + strongSelf.networkReachabilityStatusBlock(status); + } + + }; + + SCNetworkReachabilityContext context = {0, (__bridge void *)callback, AFNetworkReachabilityRetainCallback, AFNetworkReachabilityReleaseCallback, NULL}; + SCNetworkReachabilitySetCallback(self.networkReachability, AFNetworkReachabilityCallback, &context); + SCNetworkReachabilityScheduleWithRunLoop(self.networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes); + + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0),^{ + SCNetworkReachabilityFlags flags; + if (SCNetworkReachabilityGetFlags(self.networkReachability, &flags)) { + AFPostReachabilityStatusChange(flags, callback); + } + }); +} + +- (void)stopMonitoring { + if (!self.networkReachability) { + return; + } + + SCNetworkReachabilityUnscheduleFromRunLoop(self.networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes); +} + +#pragma mark - + +- (NSString *)localizedNetworkReachabilityStatusString { + return AFStringFromNetworkReachabilityStatus(self.networkReachabilityStatus); +} + +#pragma mark - + +- (void)setReachabilityStatusChangeBlock:(void (^)(AFNetworkReachabilityStatus status))block { + self.networkReachabilityStatusBlock = block; +} + +#pragma mark - NSKeyValueObserving + ++ (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key { + if ([key isEqualToString:@"reachable"] || [key isEqualToString:@"reachableViaWWAN"] || [key isEqualToString:@"reachableViaWiFi"]) { + return [NSSet setWithObject:@"networkReachabilityStatus"]; + } + + return [super keyPathsForValuesAffectingValueForKey:key]; +} + +@end +#endif diff --git a/its/plugin/projects/AFNetworking/AFNetworking/AFNetworking.h b/its/plugin/projects/AFNetworking/AFNetworking/AFNetworking.h new file mode 100644 index 00000000..e2fb2f44 --- /dev/null +++ b/its/plugin/projects/AFNetworking/AFNetworking/AFNetworking.h @@ -0,0 +1,41 @@ +// AFNetworking.h +// +// Copyright (c) 2013 AFNetworking (http://afnetworking.com/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import +#import +#import + +#ifndef _AFNETWORKING_ + #define _AFNETWORKING_ + + #import "AFURLRequestSerialization.h" + #import "AFURLResponseSerialization.h" + #import "AFSecurityPolicy.h" + +#if !TARGET_OS_WATCH + #import "AFNetworkReachabilityManager.h" +#endif + + #import "AFURLSessionManager.h" + #import "AFHTTPSessionManager.h" + +#endif /* _AFNETWORKING_ */ diff --git a/its/plugin/projects/AFNetworking/AFNetworking/AFSecurityPolicy.h b/its/plugin/projects/AFNetworking/AFNetworking/AFSecurityPolicy.h new file mode 100644 index 00000000..de3ce924 --- /dev/null +++ b/its/plugin/projects/AFNetworking/AFNetworking/AFSecurityPolicy.h @@ -0,0 +1,154 @@ +// AFSecurityPolicy.h +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import +#import + +typedef NS_ENUM(NSUInteger, AFSSLPinningMode) { + AFSSLPinningModeNone, + AFSSLPinningModePublicKey, + AFSSLPinningModeCertificate, +}; + +/** + `AFSecurityPolicy` evaluates server trust against pinned X.509 certificates and public keys over secure connections. + + Adding pinned SSL certificates to your app helps prevent man-in-the-middle attacks and other vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged to route all communication over an HTTPS connection with SSL pinning configured and enabled. + */ + +NS_ASSUME_NONNULL_BEGIN + +@interface AFSecurityPolicy : NSObject + +/** + The criteria by which server trust should be evaluated against the pinned SSL certificates. Defaults to `AFSSLPinningModeNone`. + */ +@property (readonly, nonatomic, assign) AFSSLPinningMode SSLPinningMode; + +/** + The certificates used to evaluate server trust according to the SSL pinning mode. + + By default, this property is set to any (`.cer`) certificates included in the target compiling AFNetworking. Note that if you are using AFNetworking as embedded framework, no certificates will be pinned by default. Use `certificatesInBundle` to load certificates from your target, and then create a new policy by calling `policyWithPinningMode:withPinnedCertificates`. + + Note that if pinning is enabled, `evaluateServerTrust:forDomain:` will return true if any pinned certificate matches. + */ +@property (nonatomic, strong, nullable) NSSet *pinnedCertificates; + +/** + Whether or not to trust servers with an invalid or expired SSL certificates. Defaults to `NO`. + */ +@property (nonatomic, assign) BOOL allowInvalidCertificates; + +/** + Whether or not to validate the domain name in the certificate's CN field. Defaults to `YES`. + */ +@property (nonatomic, assign) BOOL validatesDomainName; + +///----------------------------------------- +/// @name Getting Certificates from the Bundle +///----------------------------------------- + +/** + Returns any certificates included in the bundle. If you are using AFNetworking as an embedded framework, you must use this method to find the certificates you have included in your app bundle, and use them when creating your security policy by calling `policyWithPinningMode:withPinnedCertificates`. + + @return The certificates included in the given bundle. + */ ++ (NSSet *)certificatesInBundle:(NSBundle *)bundle; + +///----------------------------------------- +/// @name Getting Specific Security Policies +///----------------------------------------- + +/** + Returns the shared default security policy, which does not allow invalid certificates, validates domain name, and does not validate against pinned certificates or public keys. + + @return The default security policy. + */ ++ (instancetype)defaultPolicy; + +///--------------------- +/// @name Initialization +///--------------------- + +/** + Creates and returns a security policy with the specified pinning mode. + + @param pinningMode The SSL pinning mode. + + @return A new security policy. + */ ++ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode; + +/** + Creates and returns a security policy with the specified pinning mode. + + @param pinningMode The SSL pinning mode. + @param pinnedCertificates The certificates to pin against. + + @return A new security policy. + */ ++ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode withPinnedCertificates:(NSSet *)pinnedCertificates; + +///------------------------------ +/// @name Evaluating Server Trust +///------------------------------ + +/** + Whether or not the specified server trust should be accepted, based on the security policy. + + This method should be used when responding to an authentication challenge from a server. + + @param serverTrust The X.509 certificate trust of the server. + @param domain The domain of serverTrust. If `nil`, the domain will not be validated. + + @return Whether or not to trust the server. + */ +- (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust + forDomain:(nullable NSString *)domain; + +@end + +NS_ASSUME_NONNULL_END + +///---------------- +/// @name Constants +///---------------- + +/** + ## SSL Pinning Modes + + The following constants are provided by `AFSSLPinningMode` as possible SSL pinning modes. + + enum { + AFSSLPinningModeNone, + AFSSLPinningModePublicKey, + AFSSLPinningModeCertificate, + } + + `AFSSLPinningModeNone` + Do not used pinned certificates to validate servers. + + `AFSSLPinningModePublicKey` + Validate host certificates against public keys of pinned certificates. + + `AFSSLPinningModeCertificate` + Validate host certificates against pinned certificates. +*/ diff --git a/its/plugin/projects/AFNetworking/AFNetworking/AFSecurityPolicy.m b/its/plugin/projects/AFNetworking/AFNetworking/AFSecurityPolicy.m new file mode 100644 index 00000000..2ec602bd --- /dev/null +++ b/its/plugin/projects/AFNetworking/AFNetworking/AFSecurityPolicy.m @@ -0,0 +1,353 @@ +// AFSecurityPolicy.m +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "AFSecurityPolicy.h" + +#import + +#if !TARGET_OS_IOS && !TARGET_OS_WATCH && !TARGET_OS_TV +static NSData * AFSecKeyGetData(SecKeyRef key) { + CFDataRef data = NULL; + + __Require_noErr_Quiet(SecItemExport(key, kSecFormatUnknown, kSecItemPemArmour, NULL, &data), _out); + + return (__bridge_transfer NSData *)data; + +_out: + if (data) { + CFRelease(data); + } + + return nil; +} +#endif + +static BOOL AFSecKeyIsEqualToKey(SecKeyRef key1, SecKeyRef key2) { +#if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV + return [(__bridge id)key1 isEqual:(__bridge id)key2]; +#else + return [AFSecKeyGetData(key1) isEqual:AFSecKeyGetData(key2)]; +#endif +} + +static id AFPublicKeyForCertificate(NSData *certificate) { + id allowedPublicKey = nil; + SecCertificateRef allowedCertificate; + SecCertificateRef allowedCertificates[1]; + CFArrayRef tempCertificates = nil; + SecPolicyRef policy = nil; + SecTrustRef allowedTrust = nil; + SecTrustResultType result; + + allowedCertificate = SecCertificateCreateWithData(NULL, (__bridge CFDataRef)certificate); + __Require_Quiet(allowedCertificate != NULL, _out); + + allowedCertificates[0] = allowedCertificate; + tempCertificates = CFArrayCreate(NULL, (const void **)allowedCertificates, 1, NULL); + + policy = SecPolicyCreateBasicX509(); + __Require_noErr_Quiet(SecTrustCreateWithCertificates(tempCertificates, policy, &allowedTrust), _out); + __Require_noErr_Quiet(SecTrustEvaluate(allowedTrust, &result), _out); + + allowedPublicKey = (__bridge_transfer id)SecTrustCopyPublicKey(allowedTrust); + +_out: + if (allowedTrust) { + CFRelease(allowedTrust); + } + + if (policy) { + CFRelease(policy); + } + + if (tempCertificates) { + CFRelease(tempCertificates); + } + + if (allowedCertificate) { + CFRelease(allowedCertificate); + } + + return allowedPublicKey; +} + +static BOOL AFServerTrustIsValid(SecTrustRef serverTrust) { + BOOL isValid = NO; + SecTrustResultType result; + __Require_noErr_Quiet(SecTrustEvaluate(serverTrust, &result), _out); + + isValid = (result == kSecTrustResultUnspecified || result == kSecTrustResultProceed); + +_out: + return isValid; +} + +static NSArray * AFCertificateTrustChainForServerTrust(SecTrustRef serverTrust) { + CFIndex certificateCount = SecTrustGetCertificateCount(serverTrust); + NSMutableArray *trustChain = [NSMutableArray arrayWithCapacity:(NSUInteger)certificateCount]; + + for (CFIndex i = 0; i < certificateCount; i++) { + SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, i); + [trustChain addObject:(__bridge_transfer NSData *)SecCertificateCopyData(certificate)]; + } + + return [NSArray arrayWithArray:trustChain]; +} + +static NSArray * AFPublicKeyTrustChainForServerTrust(SecTrustRef serverTrust) { + SecPolicyRef policy = SecPolicyCreateBasicX509(); + CFIndex certificateCount = SecTrustGetCertificateCount(serverTrust); + NSMutableArray *trustChain = [NSMutableArray arrayWithCapacity:(NSUInteger)certificateCount]; + for (CFIndex i = 0; i < certificateCount; i++) { + SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, i); + + SecCertificateRef someCertificates[] = {certificate}; + CFArrayRef certificates = CFArrayCreate(NULL, (const void **)someCertificates, 1, NULL); + + SecTrustRef trust; + __Require_noErr_Quiet(SecTrustCreateWithCertificates(certificates, policy, &trust), _out); + + SecTrustResultType result; + __Require_noErr_Quiet(SecTrustEvaluate(trust, &result), _out); + + [trustChain addObject:(__bridge_transfer id)SecTrustCopyPublicKey(trust)]; + + _out: + if (trust) { + CFRelease(trust); + } + + if (certificates) { + CFRelease(certificates); + } + + continue; + } + CFRelease(policy); + + return [NSArray arrayWithArray:trustChain]; +} + +#pragma mark - + +@interface AFSecurityPolicy() +@property (readwrite, nonatomic, assign) AFSSLPinningMode SSLPinningMode; +@property (readwrite, nonatomic, strong) NSSet *pinnedPublicKeys; +@end + +@implementation AFSecurityPolicy + ++ (NSSet *)certificatesInBundle:(NSBundle *)bundle { + NSArray *paths = [bundle pathsForResourcesOfType:@"cer" inDirectory:@"."]; + + NSMutableSet *certificates = [NSMutableSet setWithCapacity:[paths count]]; + for (NSString *path in paths) { + NSData *certificateData = [NSData dataWithContentsOfFile:path]; + [certificates addObject:certificateData]; + } + + return [NSSet setWithSet:certificates]; +} + ++ (NSSet *)defaultPinnedCertificates { + static NSSet *_defaultPinnedCertificates = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + NSBundle *bundle = [NSBundle bundleForClass:[self class]]; + _defaultPinnedCertificates = [self certificatesInBundle:bundle]; + }); + + return _defaultPinnedCertificates; +} + ++ (instancetype)defaultPolicy { + AFSecurityPolicy *securityPolicy = [[self alloc] init]; + securityPolicy.SSLPinningMode = AFSSLPinningModeNone; + + return securityPolicy; +} + ++ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode { + return [self policyWithPinningMode:pinningMode withPinnedCertificates:[self defaultPinnedCertificates]]; +} + ++ (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode withPinnedCertificates:(NSSet *)pinnedCertificates { + AFSecurityPolicy *securityPolicy = [[self alloc] init]; + securityPolicy.SSLPinningMode = pinningMode; + + [securityPolicy setPinnedCertificates:pinnedCertificates]; + + return securityPolicy; +} + +- (instancetype)init { + self = [super init]; + if (!self) { + return nil; + } + + self.validatesDomainName = YES; + + return self; +} + +- (void)setPinnedCertificates:(NSSet *)pinnedCertificates { + _pinnedCertificates = pinnedCertificates; + + if (self.pinnedCertificates) { + NSMutableSet *mutablePinnedPublicKeys = [NSMutableSet setWithCapacity:[self.pinnedCertificates count]]; + for (NSData *certificate in self.pinnedCertificates) { + id publicKey = AFPublicKeyForCertificate(certificate); + if (!publicKey) { + continue; + } + [mutablePinnedPublicKeys addObject:publicKey]; + } + self.pinnedPublicKeys = [NSSet setWithSet:mutablePinnedPublicKeys]; + } else { + self.pinnedPublicKeys = nil; + } +} + +#pragma mark - + +- (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust + forDomain:(NSString *)domain +{ + if (domain && self.allowInvalidCertificates && self.validatesDomainName && (self.SSLPinningMode == AFSSLPinningModeNone || [self.pinnedCertificates count] == 0)) { + // https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/NetworkingTopics/Articles/OverridingSSLChainValidationCorrectly.html + // According to the docs, you should only trust your provided certs for evaluation. + // Pinned certificates are added to the trust. Without pinned certificates, + // there is nothing to evaluate against. + // + // From Apple Docs: + // "Do not implicitly trust self-signed certificates as anchors (kSecTrustOptionImplicitAnchors). + // Instead, add your own (self-signed) CA certificate to the list of trusted anchors." + NSLog(@"In order to validate a domain name for self signed certificates, you MUST use pinning."); + return NO; + } + + NSMutableArray *policies = [NSMutableArray array]; + if (self.validatesDomainName) { + [policies addObject:(__bridge_transfer id)SecPolicyCreateSSL(true, (__bridge CFStringRef)domain)]; + } else { + [policies addObject:(__bridge_transfer id)SecPolicyCreateBasicX509()]; + } + + SecTrustSetPolicies(serverTrust, (__bridge CFArrayRef)policies); + + if (self.SSLPinningMode == AFSSLPinningModeNone) { + return self.allowInvalidCertificates || AFServerTrustIsValid(serverTrust); + } else if (!AFServerTrustIsValid(serverTrust) && !self.allowInvalidCertificates) { + return NO; + } + + switch (self.SSLPinningMode) { + case AFSSLPinningModeNone: + default: + return NO; + case AFSSLPinningModeCertificate: { + NSMutableArray *pinnedCertificates = [NSMutableArray array]; + for (NSData *certificateData in self.pinnedCertificates) { + [pinnedCertificates addObject:(__bridge_transfer id)SecCertificateCreateWithData(NULL, (__bridge CFDataRef)certificateData)]; + } + SecTrustSetAnchorCertificates(serverTrust, (__bridge CFArrayRef)pinnedCertificates); + + if (!AFServerTrustIsValid(serverTrust)) { + return NO; + } + + // obtain the chain after being validated, which *should* contain the pinned certificate in the last position (if it's the Root CA) + NSArray *serverCertificates = AFCertificateTrustChainForServerTrust(serverTrust); + + for (NSData *trustChainCertificate in [serverCertificates reverseObjectEnumerator]) { + if ([self.pinnedCertificates containsObject:trustChainCertificate]) { + return YES; + } + } + + return NO; + } + case AFSSLPinningModePublicKey: { + NSUInteger trustedPublicKeyCount = 0; + NSArray *publicKeys = AFPublicKeyTrustChainForServerTrust(serverTrust); + + for (id trustChainPublicKey in publicKeys) { + for (id pinnedPublicKey in self.pinnedPublicKeys) { + if (AFSecKeyIsEqualToKey((__bridge SecKeyRef)trustChainPublicKey, (__bridge SecKeyRef)pinnedPublicKey)) { + trustedPublicKeyCount += 1; + } + } + } + return trustedPublicKeyCount > 0; + } + } + + return NO; +} + +#pragma mark - NSKeyValueObserving + ++ (NSSet *)keyPathsForValuesAffectingPinnedPublicKeys { + return [NSSet setWithObject:@"pinnedCertificates"]; +} + +#pragma mark - NSSecureCoding + ++ (BOOL)supportsSecureCoding { + return YES; +} + +- (instancetype)initWithCoder:(NSCoder *)decoder { + + self = [self init]; + if (!self) { + return nil; + } + + self.SSLPinningMode = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(SSLPinningMode))] unsignedIntegerValue]; + self.allowInvalidCertificates = [decoder decodeBoolForKey:NSStringFromSelector(@selector(allowInvalidCertificates))]; + self.validatesDomainName = [decoder decodeBoolForKey:NSStringFromSelector(@selector(validatesDomainName))]; + self.pinnedCertificates = [decoder decodeObjectOfClass:[NSArray class] forKey:NSStringFromSelector(@selector(pinnedCertificates))]; + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)coder { + [coder encodeObject:[NSNumber numberWithUnsignedInteger:self.SSLPinningMode] forKey:NSStringFromSelector(@selector(SSLPinningMode))]; + [coder encodeBool:self.allowInvalidCertificates forKey:NSStringFromSelector(@selector(allowInvalidCertificates))]; + [coder encodeBool:self.validatesDomainName forKey:NSStringFromSelector(@selector(validatesDomainName))]; + [coder encodeObject:self.pinnedCertificates forKey:NSStringFromSelector(@selector(pinnedCertificates))]; +} + +#pragma mark - NSCopying + +- (instancetype)copyWithZone:(NSZone *)zone { + AFSecurityPolicy *securityPolicy = [[[self class] allocWithZone:zone] init]; + securityPolicy.SSLPinningMode = self.SSLPinningMode; + securityPolicy.allowInvalidCertificates = self.allowInvalidCertificates; + securityPolicy.validatesDomainName = self.validatesDomainName; + securityPolicy.pinnedCertificates = [self.pinnedCertificates copyWithZone:zone]; + + return securityPolicy; +} + +@end diff --git a/its/plugin/projects/AFNetworking/AFNetworking/AFURLRequestSerialization.h b/its/plugin/projects/AFNetworking/AFNetworking/AFURLRequestSerialization.h new file mode 100644 index 00000000..a6f179bf --- /dev/null +++ b/its/plugin/projects/AFNetworking/AFNetworking/AFURLRequestSerialization.h @@ -0,0 +1,479 @@ +// AFURLRequestSerialization.h +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import +#import + +#if TARGET_OS_IOS || TARGET_OS_TV +#import +#elif TARGET_OS_WATCH +#import +#endif + +NS_ASSUME_NONNULL_BEGIN + +/** + Returns a percent-escaped string following RFC 3986 for a query string key or value. + RFC 3986 states that the following characters are "reserved" characters. + - General Delimiters: ":", "#", "[", "]", "@", "?", "/" + - Sub-Delimiters: "!", "$", "&", "'", "(", ")", "*", "+", ",", ";", "=" + + In RFC 3986 - Section 3.4, it states that the "?" and "/" characters should not be escaped to allow + query strings to include a URL. Therefore, all "reserved" characters with the exception of "?" and "/" + should be percent-escaped in the query string. + + @param string The string to be percent-escaped. + + @return The percent-escaped string. + */ +FOUNDATION_EXPORT NSString * AFPercentEscapedStringFromString(NSString *string); + +/** + A helper method to generate encoded url query parameters for appending to the end of a URL. + + @param parameters A dictionary of key/values to be encoded. + + @return A url encoded query string + */ +FOUNDATION_EXPORT NSString * AFQueryStringFromParameters(NSDictionary *parameters); + +/** + The `AFURLRequestSerialization` protocol is adopted by an object that encodes parameters for a specified HTTP requests. Request serializers may encode parameters as query strings, HTTP bodies, setting the appropriate HTTP header fields as necessary. + + For example, a JSON request serializer may set the HTTP body of the request to a JSON representation, and set the `Content-Type` HTTP header field value to `application/json`. + */ +@protocol AFURLRequestSerialization + +/** + Returns a request with the specified parameters encoded into a copy of the original request. + + @param request The original request. + @param parameters The parameters to be encoded. + @param error The error that occurred while attempting to encode the request parameters. + + @return A serialized request. + */ +- (nullable NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request + withParameters:(nullable id)parameters + error:(NSError * _Nullable __autoreleasing *)error NS_SWIFT_NOTHROW; + +@end + +#pragma mark - + +/** + + */ +typedef NS_ENUM(NSUInteger, AFHTTPRequestQueryStringSerializationStyle) { + AFHTTPRequestQueryStringDefaultStyle = 0, +}; + +@protocol AFMultipartFormData; + +/** + `AFHTTPRequestSerializer` conforms to the `AFURLRequestSerialization` & `AFURLResponseSerialization` protocols, offering a concrete base implementation of query string / URL form-encoded parameter serialization and default request headers, as well as response status code and content type validation. + + Any request or response serializer dealing with HTTP is encouraged to subclass `AFHTTPRequestSerializer` in order to ensure consistent default behavior. + */ +@interface AFHTTPRequestSerializer : NSObject + +/** + The string encoding used to serialize parameters. `NSUTF8StringEncoding` by default. + */ +@property (nonatomic, assign) NSStringEncoding stringEncoding; + +/** + Whether created requests can use the device’s cellular radio (if present). `YES` by default. + + @see NSMutableURLRequest -setAllowsCellularAccess: + */ +@property (nonatomic, assign) BOOL allowsCellularAccess; + +/** + The cache policy of created requests. `NSURLRequestUseProtocolCachePolicy` by default. + + @see NSMutableURLRequest -setCachePolicy: + */ +@property (nonatomic, assign) NSURLRequestCachePolicy cachePolicy; + +/** + Whether created requests should use the default cookie handling. `YES` by default. + + @see NSMutableURLRequest -setHTTPShouldHandleCookies: + */ +@property (nonatomic, assign) BOOL HTTPShouldHandleCookies; + +/** + Whether created requests can continue transmitting data before receiving a response from an earlier transmission. `NO` by default + + @see NSMutableURLRequest -setHTTPShouldUsePipelining: + */ +@property (nonatomic, assign) BOOL HTTPShouldUsePipelining; + +/** + The network service type for created requests. `NSURLNetworkServiceTypeDefault` by default. + + @see NSMutableURLRequest -setNetworkServiceType: + */ +@property (nonatomic, assign) NSURLRequestNetworkServiceType networkServiceType; + +/** + The timeout interval, in seconds, for created requests. The default timeout interval is 60 seconds. + + @see NSMutableURLRequest -setTimeoutInterval: + */ +@property (nonatomic, assign) NSTimeInterval timeoutInterval; + +///--------------------------------------- +/// @name Configuring HTTP Request Headers +///--------------------------------------- + +/** + Default HTTP header field values to be applied to serialized requests. By default, these include the following: + + - `Accept-Language` with the contents of `NSLocale +preferredLanguages` + - `User-Agent` with the contents of various bundle identifiers and OS designations + + @discussion To add or remove default request headers, use `setValue:forHTTPHeaderField:`. + */ +@property (readonly, nonatomic, strong) NSDictionary *HTTPRequestHeaders; + +/** + Creates and returns a serializer with default configuration. + */ ++ (instancetype)serializer; + +/** + Sets the value for the HTTP headers set in request objects made by the HTTP client. If `nil`, removes the existing value for that header. + + @param field The HTTP header to set a default value for + @param value The value set as default for the specified header, or `nil` + */ +- (void)setValue:(nullable NSString *)value +forHTTPHeaderField:(NSString *)field; + +/** + Returns the value for the HTTP headers set in the request serializer. + + @param field The HTTP header to retrieve the default value for + + @return The value set as default for the specified header, or `nil` + */ +- (nullable NSString *)valueForHTTPHeaderField:(NSString *)field; + +/** + Sets the "Authorization" HTTP header set in request objects made by the HTTP client to a basic authentication value with Base64-encoded username and password. This overwrites any existing value for this header. + + @param username The HTTP basic auth username + @param password The HTTP basic auth password + */ +- (void)setAuthorizationHeaderFieldWithUsername:(NSString *)username + password:(NSString *)password; + +/** + Clears any existing value for the "Authorization" HTTP header. + */ +- (void)clearAuthorizationHeader; + +///------------------------------------------------------- +/// @name Configuring Query String Parameter Serialization +///------------------------------------------------------- + +/** + HTTP methods for which serialized requests will encode parameters as a query string. `GET`, `HEAD`, and `DELETE` by default. + */ +@property (nonatomic, strong) NSSet *HTTPMethodsEncodingParametersInURI; + +/** + Set the method of query string serialization according to one of the pre-defined styles. + + @param style The serialization style. + + @see AFHTTPRequestQueryStringSerializationStyle + */ +- (void)setQueryStringSerializationWithStyle:(AFHTTPRequestQueryStringSerializationStyle)style; + +/** + Set the a custom method of query string serialization according to the specified block. + + @param block A block that defines a process of encoding parameters into a query string. This block returns the query string and takes three arguments: the request, the parameters to encode, and the error that occurred when attempting to encode parameters for the given request. + */ +- (void)setQueryStringSerializationWithBlock:(nullable NSString * (^)(NSURLRequest *request, id parameters, NSError * __autoreleasing *error))block; + +///------------------------------- +/// @name Creating Request Objects +///------------------------------- + +/** + Creates an `NSMutableURLRequest` object with the specified HTTP method and URL string. + + If the HTTP method is `GET`, `HEAD`, or `DELETE`, the parameters will be used to construct a url-encoded query string that is appended to the request's URL. Otherwise, the parameters will be encoded according to the value of the `parameterEncoding` property, and set as the request body. + + @param method The HTTP method for the request, such as `GET`, `POST`, `PUT`, or `DELETE`. This parameter must not be `nil`. + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be either set as a query string for `GET` requests, or the request HTTP body. + @param error The error that occurred while constructing the request. + + @return An `NSMutableURLRequest` object. + */ +- (NSMutableURLRequest *)requestWithMethod:(NSString *)method + URLString:(NSString *)URLString + parameters:(nullable id)parameters + error:(NSError * _Nullable __autoreleasing *)error; + +/** + Creates an `NSMutableURLRequest` object with the specified HTTP method and URLString, and constructs a `multipart/form-data` HTTP body, using the specified parameters and multipart form data block. See http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.2 + + Multipart form requests are automatically streamed, reading files directly from disk along with in-memory data in a single HTTP body. The resulting `NSMutableURLRequest` object has an `HTTPBodyStream` property, so refrain from setting `HTTPBodyStream` or `HTTPBody` on this request object, as it will clear out the multipart form body stream. + + @param method The HTTP method for the request. This parameter must not be `GET` or `HEAD`, or `nil`. + @param URLString The URL string used to create the request URL. + @param parameters The parameters to be encoded and set in the request HTTP body. + @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol. + @param error The error that occurred while constructing the request. + + @return An `NSMutableURLRequest` object + */ +- (NSMutableURLRequest *)multipartFormRequestWithMethod:(NSString *)method + URLString:(NSString *)URLString + parameters:(nullable NSDictionary *)parameters + constructingBodyWithBlock:(nullable void (^)(id formData))block + error:(NSError * _Nullable __autoreleasing *)error; + +/** + Creates an `NSMutableURLRequest` by removing the `HTTPBodyStream` from a request, and asynchronously writing its contents into the specified file, invoking the completion handler when finished. + + @param request The multipart form request. The `HTTPBodyStream` property of `request` must not be `nil`. + @param fileURL The file URL to write multipart form contents to. + @param handler A handler block to execute. + + @discussion There is a bug in `NSURLSessionTask` that causes requests to not send a `Content-Length` header when streaming contents from an HTTP body, which is notably problematic when interacting with the Amazon S3 webservice. As a workaround, this method takes a request constructed with `multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:error:`, or any other request with an `HTTPBodyStream`, writes the contents to the specified file and returns a copy of the original request with the `HTTPBodyStream` property set to `nil`. From here, the file can either be passed to `AFURLSessionManager -uploadTaskWithRequest:fromFile:progress:completionHandler:`, or have its contents read into an `NSData` that's assigned to the `HTTPBody` property of the request. + + @see https://github.com/AFNetworking/AFNetworking/issues/1398 + */ +- (NSMutableURLRequest *)requestWithMultipartFormRequest:(NSURLRequest *)request + writingStreamContentsToFile:(NSURL *)fileURL + completionHandler:(nullable void (^)(NSError * _Nullable error))handler; + +@end + +#pragma mark - + +/** + The `AFMultipartFormData` protocol defines the methods supported by the parameter in the block argument of `AFHTTPRequestSerializer -multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:`. + */ +@protocol AFMultipartFormData + +/** + Appends the HTTP header `Content-Disposition: file; filename=#{generated filename}; name=#{name}"` and `Content-Type: #{generated mimeType}`, followed by the encoded file data and the multipart form boundary. + + The filename and MIME type for this data in the form will be automatically generated, using the last path component of the `fileURL` and system associated MIME type for the `fileURL` extension, respectively. + + @param fileURL The URL corresponding to the file whose content will be appended to the form. This parameter must not be `nil`. + @param name The name to be associated with the specified data. This parameter must not be `nil`. + @param error If an error occurs, upon return contains an `NSError` object that describes the problem. + + @return `YES` if the file data was successfully appended, otherwise `NO`. + */ +- (BOOL)appendPartWithFileURL:(NSURL *)fileURL + name:(NSString *)name + error:(NSError * _Nullable __autoreleasing *)error; + +/** + Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}"` and `Content-Type: #{mimeType}`, followed by the encoded file data and the multipart form boundary. + + @param fileURL The URL corresponding to the file whose content will be appended to the form. This parameter must not be `nil`. + @param name The name to be associated with the specified data. This parameter must not be `nil`. + @param fileName The file name to be used in the `Content-Disposition` header. This parameter must not be `nil`. + @param mimeType The declared MIME type of the file data. This parameter must not be `nil`. + @param error If an error occurs, upon return contains an `NSError` object that describes the problem. + + @return `YES` if the file data was successfully appended otherwise `NO`. + */ +- (BOOL)appendPartWithFileURL:(NSURL *)fileURL + name:(NSString *)name + fileName:(NSString *)fileName + mimeType:(NSString *)mimeType + error:(NSError * _Nullable __autoreleasing *)error; + +/** + Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}"` and `Content-Type: #{mimeType}`, followed by the data from the input stream and the multipart form boundary. + + @param inputStream The input stream to be appended to the form data + @param name The name to be associated with the specified input stream. This parameter must not be `nil`. + @param fileName The filename to be associated with the specified input stream. This parameter must not be `nil`. + @param length The length of the specified input stream in bytes. + @param mimeType The MIME type of the specified data. (For example, the MIME type for a JPEG image is image/jpeg.) For a list of valid MIME types, see http://www.iana.org/assignments/media-types/. This parameter must not be `nil`. + */ +- (void)appendPartWithInputStream:(nullable NSInputStream *)inputStream + name:(NSString *)name + fileName:(NSString *)fileName + length:(int64_t)length + mimeType:(NSString *)mimeType; + +/** + Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}"` and `Content-Type: #{mimeType}`, followed by the encoded file data and the multipart form boundary. + + @param data The data to be encoded and appended to the form data. + @param name The name to be associated with the specified data. This parameter must not be `nil`. + @param fileName The filename to be associated with the specified data. This parameter must not be `nil`. + @param mimeType The MIME type of the specified data. (For example, the MIME type for a JPEG image is image/jpeg.) For a list of valid MIME types, see http://www.iana.org/assignments/media-types/. This parameter must not be `nil`. + */ +- (void)appendPartWithFileData:(NSData *)data + name:(NSString *)name + fileName:(NSString *)fileName + mimeType:(NSString *)mimeType; + +/** + Appends the HTTP headers `Content-Disposition: form-data; name=#{name}"`, followed by the encoded data and the multipart form boundary. + + @param data The data to be encoded and appended to the form data. + @param name The name to be associated with the specified data. This parameter must not be `nil`. + */ + +- (void)appendPartWithFormData:(NSData *)data + name:(NSString *)name; + + +/** + Appends HTTP headers, followed by the encoded data and the multipart form boundary. + + @param headers The HTTP headers to be appended to the form data. + @param body The data to be encoded and appended to the form data. This parameter must not be `nil`. + */ +- (void)appendPartWithHeaders:(nullable NSDictionary *)headers + body:(NSData *)body; + +/** + Throttles request bandwidth by limiting the packet size and adding a delay for each chunk read from the upload stream. + + When uploading over a 3G or EDGE connection, requests may fail with "request body stream exhausted". Setting a maximum packet size and delay according to the recommended values (`kAFUploadStream3GSuggestedPacketSize` and `kAFUploadStream3GSuggestedDelay`) lowers the risk of the input stream exceeding its allocated bandwidth. Unfortunately, there is no definite way to distinguish between a 3G, EDGE, or LTE connection over `NSURLConnection`. As such, it is not recommended that you throttle bandwidth based solely on network reachability. Instead, you should consider checking for the "request body stream exhausted" in a failure block, and then retrying the request with throttled bandwidth. + + @param numberOfBytes Maximum packet size, in number of bytes. The default packet size for an input stream is 16kb. + @param delay Duration of delay each time a packet is read. By default, no delay is set. + */ +- (void)throttleBandwidthWithPacketSize:(NSUInteger)numberOfBytes + delay:(NSTimeInterval)delay; + +@end + +#pragma mark - + +/** + `AFJSONRequestSerializer` is a subclass of `AFHTTPRequestSerializer` that encodes parameters as JSON using `NSJSONSerialization`, setting the `Content-Type` of the encoded request to `application/json`. + */ +@interface AFJSONRequestSerializer : AFHTTPRequestSerializer + +/** + Options for writing the request JSON data from Foundation objects. For possible values, see the `NSJSONSerialization` documentation section "NSJSONWritingOptions". `0` by default. + */ +@property (nonatomic, assign) NSJSONWritingOptions writingOptions; + +/** + Creates and returns a JSON serializer with specified reading and writing options. + + @param writingOptions The specified JSON writing options. + */ ++ (instancetype)serializerWithWritingOptions:(NSJSONWritingOptions)writingOptions; + +@end + +#pragma mark - + +/** + `AFPropertyListRequestSerializer` is a subclass of `AFHTTPRequestSerializer` that encodes parameters as JSON using `NSPropertyListSerializer`, setting the `Content-Type` of the encoded request to `application/x-plist`. + */ +@interface AFPropertyListRequestSerializer : AFHTTPRequestSerializer + +/** + The property list format. Possible values are described in "NSPropertyListFormat". + */ +@property (nonatomic, assign) NSPropertyListFormat format; + +/** + @warning The `writeOptions` property is currently unused. + */ +@property (nonatomic, assign) NSPropertyListWriteOptions writeOptions; + +/** + Creates and returns a property list serializer with a specified format, read options, and write options. + + @param format The property list format. + @param writeOptions The property list write options. + + @warning The `writeOptions` property is currently unused. + */ ++ (instancetype)serializerWithFormat:(NSPropertyListFormat)format + writeOptions:(NSPropertyListWriteOptions)writeOptions; + +@end + +#pragma mark - + +///---------------- +/// @name Constants +///---------------- + +/** + ## Error Domains + + The following error domain is predefined. + + - `NSString * const AFURLRequestSerializationErrorDomain` + + ### Constants + + `AFURLRequestSerializationErrorDomain` + AFURLRequestSerializer errors. Error codes for `AFURLRequestSerializationErrorDomain` correspond to codes in `NSURLErrorDomain`. + */ +FOUNDATION_EXPORT NSString * const AFURLRequestSerializationErrorDomain; + +/** + ## User info dictionary keys + + These keys may exist in the user info dictionary, in addition to those defined for NSError. + + - `NSString * const AFNetworkingOperationFailingURLRequestErrorKey` + + ### Constants + + `AFNetworkingOperationFailingURLRequestErrorKey` + The corresponding value is an `NSURLRequest` containing the request of the operation associated with an error. This key is only present in the `AFURLRequestSerializationErrorDomain`. + */ +FOUNDATION_EXPORT NSString * const AFNetworkingOperationFailingURLRequestErrorKey; + +/** + ## Throttling Bandwidth for HTTP Request Input Streams + + @see -throttleBandwidthWithPacketSize:delay: + + ### Constants + + `kAFUploadStream3GSuggestedPacketSize` + Maximum packet size, in number of bytes. Equal to 16kb. + + `kAFUploadStream3GSuggestedDelay` + Duration of delay each time a packet is read. Equal to 0.2 seconds. + */ +FOUNDATION_EXPORT NSUInteger const kAFUploadStream3GSuggestedPacketSize; +FOUNDATION_EXPORT NSTimeInterval const kAFUploadStream3GSuggestedDelay; + +NS_ASSUME_NONNULL_END diff --git a/its/plugin/projects/AFNetworking/AFNetworking/AFURLRequestSerialization.m b/its/plugin/projects/AFNetworking/AFNetworking/AFURLRequestSerialization.m new file mode 100644 index 00000000..086e6747 --- /dev/null +++ b/its/plugin/projects/AFNetworking/AFNetworking/AFURLRequestSerialization.m @@ -0,0 +1,1376 @@ +// AFURLRequestSerialization.m +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "AFURLRequestSerialization.h" + +#if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV +#import +#else +#import +#endif + +NSString * const AFURLRequestSerializationErrorDomain = @"com.alamofire.error.serialization.request"; +NSString * const AFNetworkingOperationFailingURLRequestErrorKey = @"com.alamofire.serialization.request.error.response"; + +typedef NSString * (^AFQueryStringSerializationBlock)(NSURLRequest *request, id parameters, NSError *__autoreleasing *error); + +/** + Returns a percent-escaped string following RFC 3986 for a query string key or value. + RFC 3986 states that the following characters are "reserved" characters. + - General Delimiters: ":", "#", "[", "]", "@", "?", "/" + - Sub-Delimiters: "!", "$", "&", "'", "(", ")", "*", "+", ",", ";", "=" + + In RFC 3986 - Section 3.4, it states that the "?" and "/" characters should not be escaped to allow + query strings to include a URL. Therefore, all "reserved" characters with the exception of "?" and "/" + should be percent-escaped in the query string. + - parameter string: The string to be percent-escaped. + - returns: The percent-escaped string. + */ +NSString * AFPercentEscapedStringFromString(NSString *string) { + static NSString * const kAFCharactersGeneralDelimitersToEncode = @":#[]@"; // does not include "?" or "/" due to RFC 3986 - Section 3.4 + static NSString * const kAFCharactersSubDelimitersToEncode = @"!$&'()*+,;="; + + NSMutableCharacterSet * allowedCharacterSet = [[NSCharacterSet URLQueryAllowedCharacterSet] mutableCopy]; + [allowedCharacterSet removeCharactersInString:[kAFCharactersGeneralDelimitersToEncode stringByAppendingString:kAFCharactersSubDelimitersToEncode]]; + + // FIXME: https://github.com/AFNetworking/AFNetworking/pull/3028 + // return [string stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacterSet]; + + static NSUInteger const batchSize = 50; + + NSUInteger index = 0; + NSMutableString *escaped = @"".mutableCopy; + + while (index < string.length) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wgnu" + NSUInteger length = MIN(string.length - index, batchSize); +#pragma GCC diagnostic pop + NSRange range = NSMakeRange(index, length); + + // To avoid breaking up character sequences such as 👴🏻👮🏽 + range = [string rangeOfComposedCharacterSequencesForRange:range]; + + NSString *substring = [string substringWithRange:range]; + NSString *encoded = [substring stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacterSet]; + [escaped appendString:encoded]; + + index += range.length; + } + + return escaped; +} + +#pragma mark - + +@interface AFQueryStringPair : NSObject +@property (readwrite, nonatomic, strong) id field; +@property (readwrite, nonatomic, strong) id value; + +- (instancetype)initWithField:(id)field value:(id)value; + +- (NSString *)URLEncodedStringValue; +@end + +@implementation AFQueryStringPair + +- (instancetype)initWithField:(id)field value:(id)value { + self = [super init]; + if (!self) { + return nil; + } + + self.field = field; + self.value = value; + + return self; +} + +- (NSString *)URLEncodedStringValue { + if (!self.value || [self.value isEqual:[NSNull null]]) { + return AFPercentEscapedStringFromString([self.field description]); + } else { + return [NSString stringWithFormat:@"%@=%@", AFPercentEscapedStringFromString([self.field description]), AFPercentEscapedStringFromString([self.value description])]; + } +} + +@end + +#pragma mark - + +FOUNDATION_EXPORT NSArray * AFQueryStringPairsFromDictionary(NSDictionary *dictionary); +FOUNDATION_EXPORT NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value); + +NSString * AFQueryStringFromParameters(NSDictionary *parameters) { + NSMutableArray *mutablePairs = [NSMutableArray array]; + for (AFQueryStringPair *pair in AFQueryStringPairsFromDictionary(parameters)) { + [mutablePairs addObject:[pair URLEncodedStringValue]]; + } + + return [mutablePairs componentsJoinedByString:@"&"]; +} + +NSArray * AFQueryStringPairsFromDictionary(NSDictionary *dictionary) { + return AFQueryStringPairsFromKeyAndValue(nil, dictionary); +} + +NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value) { + NSMutableArray *mutableQueryStringComponents = [NSMutableArray array]; + + NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"description" ascending:YES selector:@selector(compare:)]; + + if ([value isKindOfClass:[NSDictionary class]]) { + NSDictionary *dictionary = value; + // Sort dictionary keys to ensure consistent ordering in query string, which is important when deserializing potentially ambiguous sequences, such as an array of dictionaries + for (id nestedKey in [dictionary.allKeys sortedArrayUsingDescriptors:@[ sortDescriptor ]]) { + id nestedValue = dictionary[nestedKey]; + if (nestedValue) { + [mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue((key ? [NSString stringWithFormat:@"%@[%@]", key, nestedKey] : nestedKey), nestedValue)]; + } + } + } else if ([value isKindOfClass:[NSArray class]]) { + NSArray *array = value; + for (id nestedValue in array) { + [mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue([NSString stringWithFormat:@"%@[]", key], nestedValue)]; + } + } else if ([value isKindOfClass:[NSSet class]]) { + NSSet *set = value; + for (id obj in [set sortedArrayUsingDescriptors:@[ sortDescriptor ]]) { + [mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue(key, obj)]; + } + } else { + [mutableQueryStringComponents addObject:[[AFQueryStringPair alloc] initWithField:key value:value]]; + } + + return mutableQueryStringComponents; +} + +#pragma mark - + +@interface AFStreamingMultipartFormData : NSObject +- (instancetype)initWithURLRequest:(NSMutableURLRequest *)urlRequest + stringEncoding:(NSStringEncoding)encoding; + +- (NSMutableURLRequest *)requestByFinalizingMultipartFormData; +@end + +#pragma mark - + +static NSArray * AFHTTPRequestSerializerObservedKeyPaths() { + static NSArray *_AFHTTPRequestSerializerObservedKeyPaths = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + _AFHTTPRequestSerializerObservedKeyPaths = @[NSStringFromSelector(@selector(allowsCellularAccess)), NSStringFromSelector(@selector(cachePolicy)), NSStringFromSelector(@selector(HTTPShouldHandleCookies)), NSStringFromSelector(@selector(HTTPShouldUsePipelining)), NSStringFromSelector(@selector(networkServiceType)), NSStringFromSelector(@selector(timeoutInterval))]; + }); + + return _AFHTTPRequestSerializerObservedKeyPaths; +} + +static void *AFHTTPRequestSerializerObserverContext = &AFHTTPRequestSerializerObserverContext; + +@interface AFHTTPRequestSerializer () +@property (readwrite, nonatomic, strong) NSMutableSet *mutableObservedChangedKeyPaths; +@property (readwrite, nonatomic, strong) NSMutableDictionary *mutableHTTPRequestHeaders; +@property (readwrite, nonatomic, assign) AFHTTPRequestQueryStringSerializationStyle queryStringSerializationStyle; +@property (readwrite, nonatomic, copy) AFQueryStringSerializationBlock queryStringSerialization; +@end + +@implementation AFHTTPRequestSerializer + ++ (instancetype)serializer { + return [[self alloc] init]; +} + +- (instancetype)init { + self = [super init]; + if (!self) { + return nil; + } + + self.stringEncoding = NSUTF8StringEncoding; + + self.mutableHTTPRequestHeaders = [NSMutableDictionary dictionary]; + + // Accept-Language HTTP Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4 + NSMutableArray *acceptLanguagesComponents = [NSMutableArray array]; + [[NSLocale preferredLanguages] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { + float q = 1.0f - (idx * 0.1f); + [acceptLanguagesComponents addObject:[NSString stringWithFormat:@"%@;q=%0.1g", obj, q]]; + *stop = q <= 0.5f; + }]; + [self setValue:[acceptLanguagesComponents componentsJoinedByString:@", "] forHTTPHeaderField:@"Accept-Language"]; + + NSString *userAgent = nil; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu" +#if TARGET_OS_IOS + // User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43 + userAgent = [NSString stringWithFormat:@"%@/%@ (%@; iOS %@; Scale/%0.2f)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion], [[UIScreen mainScreen] scale]]; +#elif TARGET_OS_WATCH + // User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43 + userAgent = [NSString stringWithFormat:@"%@/%@ (%@; watchOS %@; Scale/%0.2f)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[WKInterfaceDevice currentDevice] model], [[WKInterfaceDevice currentDevice] systemVersion], [[WKInterfaceDevice currentDevice] screenScale]]; +#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) + userAgent = [NSString stringWithFormat:@"%@/%@ (Mac OS X %@)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[NSProcessInfo processInfo] operatingSystemVersionString]]; +#endif +#pragma clang diagnostic pop + if (userAgent) { + if (![userAgent canBeConvertedToEncoding:NSASCIIStringEncoding]) { + NSMutableString *mutableUserAgent = [userAgent mutableCopy]; + if (CFStringTransform((__bridge CFMutableStringRef)(mutableUserAgent), NULL, (__bridge CFStringRef)@"Any-Latin; Latin-ASCII; [:^ASCII:] Remove", false)) { + userAgent = mutableUserAgent; + } + } + [self setValue:userAgent forHTTPHeaderField:@"User-Agent"]; + } + + // HTTP Method Definitions; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html + self.HTTPMethodsEncodingParametersInURI = [NSSet setWithObjects:@"GET", @"HEAD", @"DELETE", nil]; + + self.mutableObservedChangedKeyPaths = [NSMutableSet set]; + for (NSString *keyPath in AFHTTPRequestSerializerObservedKeyPaths()) { + if ([self respondsToSelector:NSSelectorFromString(keyPath)]) { + [self addObserver:self forKeyPath:keyPath options:NSKeyValueObservingOptionNew context:AFHTTPRequestSerializerObserverContext]; + } + } + + return self; +} + +- (void)dealloc { + for (NSString *keyPath in AFHTTPRequestSerializerObservedKeyPaths()) { + if ([self respondsToSelector:NSSelectorFromString(keyPath)]) { + [self removeObserver:self forKeyPath:keyPath context:AFHTTPRequestSerializerObserverContext]; + } + } +} + +#pragma mark - + +// Workarounds for crashing behavior using Key-Value Observing with XCTest +// See https://github.com/AFNetworking/AFNetworking/issues/2523 + +- (void)setAllowsCellularAccess:(BOOL)allowsCellularAccess { + [self willChangeValueForKey:NSStringFromSelector(@selector(allowsCellularAccess))]; + _allowsCellularAccess = allowsCellularAccess; + [self didChangeValueForKey:NSStringFromSelector(@selector(allowsCellularAccess))]; +} + +- (void)setCachePolicy:(NSURLRequestCachePolicy)cachePolicy { + [self willChangeValueForKey:NSStringFromSelector(@selector(cachePolicy))]; + _cachePolicy = cachePolicy; + [self didChangeValueForKey:NSStringFromSelector(@selector(cachePolicy))]; +} + +- (void)setHTTPShouldHandleCookies:(BOOL)HTTPShouldHandleCookies { + [self willChangeValueForKey:NSStringFromSelector(@selector(HTTPShouldHandleCookies))]; + _HTTPShouldHandleCookies = HTTPShouldHandleCookies; + [self didChangeValueForKey:NSStringFromSelector(@selector(HTTPShouldHandleCookies))]; +} + +- (void)setHTTPShouldUsePipelining:(BOOL)HTTPShouldUsePipelining { + [self willChangeValueForKey:NSStringFromSelector(@selector(HTTPShouldUsePipelining))]; + _HTTPShouldUsePipelining = HTTPShouldUsePipelining; + [self didChangeValueForKey:NSStringFromSelector(@selector(HTTPShouldUsePipelining))]; +} + +- (void)setNetworkServiceType:(NSURLRequestNetworkServiceType)networkServiceType { + [self willChangeValueForKey:NSStringFromSelector(@selector(networkServiceType))]; + _networkServiceType = networkServiceType; + [self didChangeValueForKey:NSStringFromSelector(@selector(networkServiceType))]; +} + +- (void)setTimeoutInterval:(NSTimeInterval)timeoutInterval { + [self willChangeValueForKey:NSStringFromSelector(@selector(timeoutInterval))]; + _timeoutInterval = timeoutInterval; + [self didChangeValueForKey:NSStringFromSelector(@selector(timeoutInterval))]; +} + +#pragma mark - + +- (NSDictionary *)HTTPRequestHeaders { + return [NSDictionary dictionaryWithDictionary:self.mutableHTTPRequestHeaders]; +} + +- (void)setValue:(NSString *)value +forHTTPHeaderField:(NSString *)field +{ + [self.mutableHTTPRequestHeaders setValue:value forKey:field]; +} + +- (NSString *)valueForHTTPHeaderField:(NSString *)field { + return [self.mutableHTTPRequestHeaders valueForKey:field]; +} + +- (void)setAuthorizationHeaderFieldWithUsername:(NSString *)username + password:(NSString *)password +{ + NSData *basicAuthCredentials = [[NSString stringWithFormat:@"%@:%@", username, password] dataUsingEncoding:NSUTF8StringEncoding]; + NSString *base64AuthCredentials = [basicAuthCredentials base64EncodedStringWithOptions:(NSDataBase64EncodingOptions)0]; + [self setValue:[NSString stringWithFormat:@"Basic %@", base64AuthCredentials] forHTTPHeaderField:@"Authorization"]; +} + +- (void)clearAuthorizationHeader { + [self.mutableHTTPRequestHeaders removeObjectForKey:@"Authorization"]; +} + +#pragma mark - + +- (void)setQueryStringSerializationWithStyle:(AFHTTPRequestQueryStringSerializationStyle)style { + self.queryStringSerializationStyle = style; + self.queryStringSerialization = nil; +} + +- (void)setQueryStringSerializationWithBlock:(NSString *(^)(NSURLRequest *, id, NSError *__autoreleasing *))block { + self.queryStringSerialization = block; +} + +#pragma mark - + +- (NSMutableURLRequest *)requestWithMethod:(NSString *)method + URLString:(NSString *)URLString + parameters:(id)parameters + error:(NSError *__autoreleasing *)error +{ + NSParameterAssert(method); + NSParameterAssert(URLString); + + NSURL *url = [NSURL URLWithString:URLString]; + + NSParameterAssert(url); + + NSMutableURLRequest *mutableRequest = [[NSMutableURLRequest alloc] initWithURL:url]; + mutableRequest.HTTPMethod = method; + + for (NSString *keyPath in AFHTTPRequestSerializerObservedKeyPaths()) { + if ([self.mutableObservedChangedKeyPaths containsObject:keyPath]) { + [mutableRequest setValue:[self valueForKeyPath:keyPath] forKey:keyPath]; + } + } + + mutableRequest = [[self requestBySerializingRequest:mutableRequest withParameters:parameters error:error] mutableCopy]; + + return mutableRequest; +} + +- (NSMutableURLRequest *)multipartFormRequestWithMethod:(NSString *)method + URLString:(NSString *)URLString + parameters:(NSDictionary *)parameters + constructingBodyWithBlock:(void (^)(id formData))block + error:(NSError *__autoreleasing *)error +{ + NSParameterAssert(method); + NSParameterAssert(![method isEqualToString:@"GET"] && ![method isEqualToString:@"HEAD"]); + + NSMutableURLRequest *mutableRequest = [self requestWithMethod:method URLString:URLString parameters:nil error:error]; + + __block AFStreamingMultipartFormData *formData = [[AFStreamingMultipartFormData alloc] initWithURLRequest:mutableRequest stringEncoding:NSUTF8StringEncoding]; + + if (parameters) { + for (AFQueryStringPair *pair in AFQueryStringPairsFromDictionary(parameters)) { + NSData *data = nil; + if ([pair.value isKindOfClass:[NSData class]]) { + data = pair.value; + } else if ([pair.value isEqual:[NSNull null]]) { + data = [NSData data]; + } else { + data = [[pair.value description] dataUsingEncoding:self.stringEncoding]; + } + + if (data) { + [formData appendPartWithFormData:data name:[pair.field description]]; + } + } + } + + if (block) { + block(formData); + } + + return [formData requestByFinalizingMultipartFormData]; +} + +- (NSMutableURLRequest *)requestWithMultipartFormRequest:(NSURLRequest *)request + writingStreamContentsToFile:(NSURL *)fileURL + completionHandler:(void (^)(NSError *error))handler +{ + NSParameterAssert(request.HTTPBodyStream); + NSParameterAssert([fileURL isFileURL]); + + NSInputStream *inputStream = request.HTTPBodyStream; + NSOutputStream *outputStream = [[NSOutputStream alloc] initWithURL:fileURL append:NO]; + __block NSError *error = nil; + + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + [inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; + [outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; + + [inputStream open]; + [outputStream open]; + + while ([inputStream hasBytesAvailable] && [outputStream hasSpaceAvailable]) { + uint8_t buffer[1024]; + + NSInteger bytesRead = [inputStream read:buffer maxLength:1024]; + if (inputStream.streamError || bytesRead < 0) { + error = inputStream.streamError; + break; + } + + NSInteger bytesWritten = [outputStream write:buffer maxLength:(NSUInteger)bytesRead]; + if (outputStream.streamError || bytesWritten < 0) { + error = outputStream.streamError; + break; + } + + if (bytesRead == 0 && bytesWritten == 0) { + break; + } + } + + [outputStream close]; + [inputStream close]; + + if (handler) { + dispatch_async(dispatch_get_main_queue(), ^{ + handler(error); + }); + } + }); + + NSMutableURLRequest *mutableRequest = [request mutableCopy]; + mutableRequest.HTTPBodyStream = nil; + + return mutableRequest; +} + +#pragma mark - AFURLRequestSerialization + +- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request + withParameters:(id)parameters + error:(NSError *__autoreleasing *)error +{ + NSParameterAssert(request); + + NSMutableURLRequest *mutableRequest = [request mutableCopy]; + + [self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(id field, id value, BOOL * __unused stop) { + if (![request valueForHTTPHeaderField:field]) { + [mutableRequest setValue:value forHTTPHeaderField:field]; + } + }]; + + NSString *query = nil; + if (parameters) { + if (self.queryStringSerialization) { + NSError *serializationError; + query = self.queryStringSerialization(request, parameters, &serializationError); + + if (serializationError) { + if (error) { + *error = serializationError; + } + + return nil; + } + } else { + switch (self.queryStringSerializationStyle) { + case AFHTTPRequestQueryStringDefaultStyle: + query = AFQueryStringFromParameters(parameters); + break; + } + } + } + + if ([self.HTTPMethodsEncodingParametersInURI containsObject:[[request HTTPMethod] uppercaseString]]) { + if (query) { + mutableRequest.URL = [NSURL URLWithString:[[mutableRequest.URL absoluteString] stringByAppendingFormat:mutableRequest.URL.query ? @"&%@" : @"?%@", query]]; + } + } else { + // #2864: an empty string is a valid x-www-form-urlencoded payload + if (!query) { + query = @""; + } + if (![mutableRequest valueForHTTPHeaderField:@"Content-Type"]) { + [mutableRequest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; + } + [mutableRequest setHTTPBody:[query dataUsingEncoding:self.stringEncoding]]; + } + + return mutableRequest; +} + +#pragma mark - NSKeyValueObserving + ++ (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key { + if ([AFHTTPRequestSerializerObservedKeyPaths() containsObject:key]) { + return NO; + } + + return [super automaticallyNotifiesObserversForKey:key]; +} + +- (void)observeValueForKeyPath:(NSString *)keyPath + ofObject:(__unused id)object + change:(NSDictionary *)change + context:(void *)context +{ + if (context == AFHTTPRequestSerializerObserverContext) { + if ([change[NSKeyValueChangeNewKey] isEqual:[NSNull null]]) { + [self.mutableObservedChangedKeyPaths removeObject:keyPath]; + } else { + [self.mutableObservedChangedKeyPaths addObject:keyPath]; + } + } +} + +#pragma mark - NSSecureCoding + ++ (BOOL)supportsSecureCoding { + return YES; +} + +- (instancetype)initWithCoder:(NSCoder *)decoder { + self = [self init]; + if (!self) { + return nil; + } + + self.mutableHTTPRequestHeaders = [[decoder decodeObjectOfClass:[NSDictionary class] forKey:NSStringFromSelector(@selector(mutableHTTPRequestHeaders))] mutableCopy]; + self.queryStringSerializationStyle = (AFHTTPRequestQueryStringSerializationStyle)[[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(queryStringSerializationStyle))] unsignedIntegerValue]; + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)coder { + [coder encodeObject:self.mutableHTTPRequestHeaders forKey:NSStringFromSelector(@selector(mutableHTTPRequestHeaders))]; + [coder encodeInteger:self.queryStringSerializationStyle forKey:NSStringFromSelector(@selector(queryStringSerializationStyle))]; +} + +#pragma mark - NSCopying + +- (instancetype)copyWithZone:(NSZone *)zone { + AFHTTPRequestSerializer *serializer = [[[self class] allocWithZone:zone] init]; + serializer.mutableHTTPRequestHeaders = [self.mutableHTTPRequestHeaders mutableCopyWithZone:zone]; + serializer.queryStringSerializationStyle = self.queryStringSerializationStyle; + serializer.queryStringSerialization = self.queryStringSerialization; + + return serializer; +} + +@end + +#pragma mark - + +static NSString * AFCreateMultipartFormBoundary() { + return [NSString stringWithFormat:@"Boundary+%08X%08X", arc4random(), arc4random()]; +} + +static NSString * const kAFMultipartFormCRLF = @"\r\n"; + +static inline NSString * AFMultipartFormInitialBoundary(NSString *boundary) { + return [NSString stringWithFormat:@"--%@%@", boundary, kAFMultipartFormCRLF]; +} + +static inline NSString * AFMultipartFormEncapsulationBoundary(NSString *boundary) { + return [NSString stringWithFormat:@"%@--%@%@", kAFMultipartFormCRLF, boundary, kAFMultipartFormCRLF]; +} + +static inline NSString * AFMultipartFormFinalBoundary(NSString *boundary) { + return [NSString stringWithFormat:@"%@--%@--%@", kAFMultipartFormCRLF, boundary, kAFMultipartFormCRLF]; +} + +static inline NSString * AFContentTypeForPathExtension(NSString *extension) { + NSString *UTI = (__bridge_transfer NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)extension, NULL); + NSString *contentType = (__bridge_transfer NSString *)UTTypeCopyPreferredTagWithClass((__bridge CFStringRef)UTI, kUTTagClassMIMEType); + if (!contentType) { + return @"application/octet-stream"; + } else { + return contentType; + } +} + +NSUInteger const kAFUploadStream3GSuggestedPacketSize = 1024 * 16; +NSTimeInterval const kAFUploadStream3GSuggestedDelay = 0.2; + +@interface AFHTTPBodyPart : NSObject +@property (nonatomic, assign) NSStringEncoding stringEncoding; +@property (nonatomic, strong) NSDictionary *headers; +@property (nonatomic, copy) NSString *boundary; +@property (nonatomic, strong) id body; +@property (nonatomic, assign) unsigned long long bodyContentLength; +@property (nonatomic, strong) NSInputStream *inputStream; + +@property (nonatomic, assign) BOOL hasInitialBoundary; +@property (nonatomic, assign) BOOL hasFinalBoundary; + +@property (readonly, nonatomic, assign, getter = hasBytesAvailable) BOOL bytesAvailable; +@property (readonly, nonatomic, assign) unsigned long long contentLength; + +- (NSInteger)read:(uint8_t *)buffer + maxLength:(NSUInteger)length; +@end + +@interface AFMultipartBodyStream : NSInputStream +@property (nonatomic, assign) NSUInteger numberOfBytesInPacket; +@property (nonatomic, assign) NSTimeInterval delay; +@property (nonatomic, strong) NSInputStream *inputStream; +@property (readonly, nonatomic, assign) unsigned long long contentLength; +@property (readonly, nonatomic, assign, getter = isEmpty) BOOL empty; + +- (instancetype)initWithStringEncoding:(NSStringEncoding)encoding; +- (void)setInitialAndFinalBoundaries; +- (void)appendHTTPBodyPart:(AFHTTPBodyPart *)bodyPart; +@end + +#pragma mark - + +@interface AFStreamingMultipartFormData () +@property (readwrite, nonatomic, copy) NSMutableURLRequest *request; +@property (readwrite, nonatomic, assign) NSStringEncoding stringEncoding; +@property (readwrite, nonatomic, copy) NSString *boundary; +@property (readwrite, nonatomic, strong) AFMultipartBodyStream *bodyStream; +@end + +@implementation AFStreamingMultipartFormData + +- (instancetype)initWithURLRequest:(NSMutableURLRequest *)urlRequest + stringEncoding:(NSStringEncoding)encoding +{ + self = [super init]; + if (!self) { + return nil; + } + + self.request = urlRequest; + self.stringEncoding = encoding; + self.boundary = AFCreateMultipartFormBoundary(); + self.bodyStream = [[AFMultipartBodyStream alloc] initWithStringEncoding:encoding]; + + return self; +} + +- (BOOL)appendPartWithFileURL:(NSURL *)fileURL + name:(NSString *)name + error:(NSError * __autoreleasing *)error +{ + NSParameterAssert(fileURL); + NSParameterAssert(name); + + NSString *fileName = [fileURL lastPathComponent]; + NSString *mimeType = AFContentTypeForPathExtension([fileURL pathExtension]); + + return [self appendPartWithFileURL:fileURL name:name fileName:fileName mimeType:mimeType error:error]; +} + +- (BOOL)appendPartWithFileURL:(NSURL *)fileURL + name:(NSString *)name + fileName:(NSString *)fileName + mimeType:(NSString *)mimeType + error:(NSError * __autoreleasing *)error +{ + NSParameterAssert(fileURL); + NSParameterAssert(name); + NSParameterAssert(fileName); + NSParameterAssert(mimeType); + + if (![fileURL isFileURL]) { + NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey: NSLocalizedStringFromTable(@"Expected URL to be a file URL", @"AFNetworking", nil)}; + if (error) { + *error = [[NSError alloc] initWithDomain:AFURLRequestSerializationErrorDomain code:NSURLErrorBadURL userInfo:userInfo]; + } + + return NO; + } else if ([fileURL checkResourceIsReachableAndReturnError:error] == NO) { + NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey: NSLocalizedStringFromTable(@"File URL not reachable.", @"AFNetworking", nil)}; + if (error) { + *error = [[NSError alloc] initWithDomain:AFURLRequestSerializationErrorDomain code:NSURLErrorBadURL userInfo:userInfo]; + } + + return NO; + } + + NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:[fileURL path] error:error]; + if (!fileAttributes) { + return NO; + } + + NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary]; + [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"; filename=\"%@\"", name, fileName] forKey:@"Content-Disposition"]; + [mutableHeaders setValue:mimeType forKey:@"Content-Type"]; + + AFHTTPBodyPart *bodyPart = [[AFHTTPBodyPart alloc] init]; + bodyPart.stringEncoding = self.stringEncoding; + bodyPart.headers = mutableHeaders; + bodyPart.boundary = self.boundary; + bodyPart.body = fileURL; + bodyPart.bodyContentLength = [fileAttributes[NSFileSize] unsignedLongLongValue]; + [self.bodyStream appendHTTPBodyPart:bodyPart]; + + return YES; +} + +- (void)appendPartWithInputStream:(NSInputStream *)inputStream + name:(NSString *)name + fileName:(NSString *)fileName + length:(int64_t)length + mimeType:(NSString *)mimeType +{ + NSParameterAssert(name); + NSParameterAssert(fileName); + NSParameterAssert(mimeType); + + NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary]; + [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"; filename=\"%@\"", name, fileName] forKey:@"Content-Disposition"]; + [mutableHeaders setValue:mimeType forKey:@"Content-Type"]; + + AFHTTPBodyPart *bodyPart = [[AFHTTPBodyPart alloc] init]; + bodyPart.stringEncoding = self.stringEncoding; + bodyPart.headers = mutableHeaders; + bodyPart.boundary = self.boundary; + bodyPart.body = inputStream; + + bodyPart.bodyContentLength = (unsigned long long)length; + + [self.bodyStream appendHTTPBodyPart:bodyPart]; +} + +- (void)appendPartWithFileData:(NSData *)data + name:(NSString *)name + fileName:(NSString *)fileName + mimeType:(NSString *)mimeType +{ + NSParameterAssert(name); + NSParameterAssert(fileName); + NSParameterAssert(mimeType); + + NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary]; + [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"; filename=\"%@\"", name, fileName] forKey:@"Content-Disposition"]; + [mutableHeaders setValue:mimeType forKey:@"Content-Type"]; + + [self appendPartWithHeaders:mutableHeaders body:data]; +} + +- (void)appendPartWithFormData:(NSData *)data + name:(NSString *)name +{ + NSParameterAssert(name); + + NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary]; + [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"", name] forKey:@"Content-Disposition"]; + + [self appendPartWithHeaders:mutableHeaders body:data]; +} + +- (void)appendPartWithHeaders:(NSDictionary *)headers + body:(NSData *)body +{ + NSParameterAssert(body); + + AFHTTPBodyPart *bodyPart = [[AFHTTPBodyPart alloc] init]; + bodyPart.stringEncoding = self.stringEncoding; + bodyPart.headers = headers; + bodyPart.boundary = self.boundary; + bodyPart.bodyContentLength = [body length]; + bodyPart.body = body; + + [self.bodyStream appendHTTPBodyPart:bodyPart]; +} + +- (void)throttleBandwidthWithPacketSize:(NSUInteger)numberOfBytes + delay:(NSTimeInterval)delay +{ + self.bodyStream.numberOfBytesInPacket = numberOfBytes; + self.bodyStream.delay = delay; +} + +- (NSMutableURLRequest *)requestByFinalizingMultipartFormData { + if ([self.bodyStream isEmpty]) { + return self.request; + } + + // Reset the initial and final boundaries to ensure correct Content-Length + [self.bodyStream setInitialAndFinalBoundaries]; + [self.request setHTTPBodyStream:self.bodyStream]; + + [self.request setValue:[NSString stringWithFormat:@"multipart/form-data; boundary=%@", self.boundary] forHTTPHeaderField:@"Content-Type"]; + [self.request setValue:[NSString stringWithFormat:@"%llu", [self.bodyStream contentLength]] forHTTPHeaderField:@"Content-Length"]; + + return self.request; +} + +@end + +#pragma mark - + +@interface NSStream () +@property (readwrite) NSStreamStatus streamStatus; +@property (readwrite, copy) NSError *streamError; +@end + +@interface AFMultipartBodyStream () +@property (readwrite, nonatomic, assign) NSStringEncoding stringEncoding; +@property (readwrite, nonatomic, strong) NSMutableArray *HTTPBodyParts; +@property (readwrite, nonatomic, strong) NSEnumerator *HTTPBodyPartEnumerator; +@property (readwrite, nonatomic, strong) AFHTTPBodyPart *currentHTTPBodyPart; +@property (readwrite, nonatomic, strong) NSOutputStream *outputStream; +@property (readwrite, nonatomic, strong) NSMutableData *buffer; +@end + +@implementation AFMultipartBodyStream +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wimplicit-atomic-properties" +#if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000) || (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1100) +@synthesize delegate; +#endif +@synthesize streamStatus; +@synthesize streamError; +#pragma clang diagnostic pop + +- (instancetype)initWithStringEncoding:(NSStringEncoding)encoding { + self = [super init]; + if (!self) { + return nil; + } + + self.stringEncoding = encoding; + self.HTTPBodyParts = [NSMutableArray array]; + self.numberOfBytesInPacket = NSIntegerMax; + + return self; +} + +- (void)setInitialAndFinalBoundaries { + if ([self.HTTPBodyParts count] > 0) { + for (AFHTTPBodyPart *bodyPart in self.HTTPBodyParts) { + bodyPart.hasInitialBoundary = NO; + bodyPart.hasFinalBoundary = NO; + } + + [[self.HTTPBodyParts firstObject] setHasInitialBoundary:YES]; + [[self.HTTPBodyParts lastObject] setHasFinalBoundary:YES]; + } +} + +- (void)appendHTTPBodyPart:(AFHTTPBodyPart *)bodyPart { + [self.HTTPBodyParts addObject:bodyPart]; +} + +- (BOOL)isEmpty { + return [self.HTTPBodyParts count] == 0; +} + +#pragma mark - NSInputStream + +- (NSInteger)read:(uint8_t *)buffer + maxLength:(NSUInteger)length +{ + if ([self streamStatus] == NSStreamStatusClosed) { + return 0; + } + + NSInteger totalNumberOfBytesRead = 0; + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu" + while ((NSUInteger)totalNumberOfBytesRead < MIN(length, self.numberOfBytesInPacket)) { + if (!self.currentHTTPBodyPart || ![self.currentHTTPBodyPart hasBytesAvailable]) { + if (!(self.currentHTTPBodyPart = [self.HTTPBodyPartEnumerator nextObject])) { + break; + } + } else { + NSUInteger maxLength = MIN(length, self.numberOfBytesInPacket) - (NSUInteger)totalNumberOfBytesRead; + NSInteger numberOfBytesRead = [self.currentHTTPBodyPart read:&buffer[totalNumberOfBytesRead] maxLength:maxLength]; + if (numberOfBytesRead == -1) { + self.streamError = self.currentHTTPBodyPart.inputStream.streamError; + break; + } else { + totalNumberOfBytesRead += numberOfBytesRead; + + if (self.delay > 0.0f) { + [NSThread sleepForTimeInterval:self.delay]; + } + } + } + } +#pragma clang diagnostic pop + + return totalNumberOfBytesRead; +} + +- (BOOL)getBuffer:(__unused uint8_t **)buffer + length:(__unused NSUInteger *)len +{ + return NO; +} + +- (BOOL)hasBytesAvailable { + return [self streamStatus] == NSStreamStatusOpen; +} + +#pragma mark - NSStream + +- (void)open { + if (self.streamStatus == NSStreamStatusOpen) { + return; + } + + self.streamStatus = NSStreamStatusOpen; + + [self setInitialAndFinalBoundaries]; + self.HTTPBodyPartEnumerator = [self.HTTPBodyParts objectEnumerator]; +} + +- (void)close { + self.streamStatus = NSStreamStatusClosed; +} + +- (id)propertyForKey:(__unused NSString *)key { + return nil; +} + +- (BOOL)setProperty:(__unused id)property + forKey:(__unused NSString *)key +{ + return NO; +} + +- (void)scheduleInRunLoop:(__unused NSRunLoop *)aRunLoop + forMode:(__unused NSString *)mode +{} + +- (void)removeFromRunLoop:(__unused NSRunLoop *)aRunLoop + forMode:(__unused NSString *)mode +{} + +- (unsigned long long)contentLength { + unsigned long long length = 0; + for (AFHTTPBodyPart *bodyPart in self.HTTPBodyParts) { + length += [bodyPart contentLength]; + } + + return length; +} + +#pragma mark - Undocumented CFReadStream Bridged Methods + +- (void)_scheduleInCFRunLoop:(__unused CFRunLoopRef)aRunLoop + forMode:(__unused CFStringRef)aMode +{} + +- (void)_unscheduleFromCFRunLoop:(__unused CFRunLoopRef)aRunLoop + forMode:(__unused CFStringRef)aMode +{} + +- (BOOL)_setCFClientFlags:(__unused CFOptionFlags)inFlags + callback:(__unused CFReadStreamClientCallBack)inCallback + context:(__unused CFStreamClientContext *)inContext { + return NO; +} + +#pragma mark - NSCopying + +- (instancetype)copyWithZone:(NSZone *)zone { + AFMultipartBodyStream *bodyStreamCopy = [[[self class] allocWithZone:zone] initWithStringEncoding:self.stringEncoding]; + + for (AFHTTPBodyPart *bodyPart in self.HTTPBodyParts) { + [bodyStreamCopy appendHTTPBodyPart:[bodyPart copy]]; + } + + [bodyStreamCopy setInitialAndFinalBoundaries]; + + return bodyStreamCopy; +} + +@end + +#pragma mark - + +typedef enum { + AFEncapsulationBoundaryPhase = 1, + AFHeaderPhase = 2, + AFBodyPhase = 3, + AFFinalBoundaryPhase = 4, +} AFHTTPBodyPartReadPhase; + +@interface AFHTTPBodyPart () { + AFHTTPBodyPartReadPhase _phase; + NSInputStream *_inputStream; + unsigned long long _phaseReadOffset; +} + +- (BOOL)transitionToNextPhase; +- (NSInteger)readData:(NSData *)data + intoBuffer:(uint8_t *)buffer + maxLength:(NSUInteger)length; +@end + +@implementation AFHTTPBodyPart + +- (instancetype)init { + self = [super init]; + if (!self) { + return nil; + } + + [self transitionToNextPhase]; + + return self; +} + +- (void)dealloc { + if (_inputStream) { + [_inputStream close]; + _inputStream = nil; + } +} + +- (NSInputStream *)inputStream { + if (!_inputStream) { + if ([self.body isKindOfClass:[NSData class]]) { + _inputStream = [NSInputStream inputStreamWithData:self.body]; + } else if ([self.body isKindOfClass:[NSURL class]]) { + _inputStream = [NSInputStream inputStreamWithURL:self.body]; + } else if ([self.body isKindOfClass:[NSInputStream class]]) { + _inputStream = self.body; + } else { + _inputStream = [NSInputStream inputStreamWithData:[NSData data]]; + } + } + + return _inputStream; +} + +- (NSString *)stringForHeaders { + NSMutableString *headerString = [NSMutableString string]; + for (NSString *field in [self.headers allKeys]) { + [headerString appendString:[NSString stringWithFormat:@"%@: %@%@", field, [self.headers valueForKey:field], kAFMultipartFormCRLF]]; + } + [headerString appendString:kAFMultipartFormCRLF]; + + return [NSString stringWithString:headerString]; +} + +- (unsigned long long)contentLength { + unsigned long long length = 0; + + NSData *encapsulationBoundaryData = [([self hasInitialBoundary] ? AFMultipartFormInitialBoundary(self.boundary) : AFMultipartFormEncapsulationBoundary(self.boundary)) dataUsingEncoding:self.stringEncoding]; + length += [encapsulationBoundaryData length]; + + NSData *headersData = [[self stringForHeaders] dataUsingEncoding:self.stringEncoding]; + length += [headersData length]; + + length += _bodyContentLength; + + NSData *closingBoundaryData = ([self hasFinalBoundary] ? [AFMultipartFormFinalBoundary(self.boundary) dataUsingEncoding:self.stringEncoding] : [NSData data]); + length += [closingBoundaryData length]; + + return length; +} + +- (BOOL)hasBytesAvailable { + // Allows `read:maxLength:` to be called again if `AFMultipartFormFinalBoundary` doesn't fit into the available buffer + if (_phase == AFFinalBoundaryPhase) { + return YES; + } + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wcovered-switch-default" + switch (self.inputStream.streamStatus) { + case NSStreamStatusNotOpen: + case NSStreamStatusOpening: + case NSStreamStatusOpen: + case NSStreamStatusReading: + case NSStreamStatusWriting: + return YES; + case NSStreamStatusAtEnd: + case NSStreamStatusClosed: + case NSStreamStatusError: + default: + return NO; + } +#pragma clang diagnostic pop +} + +- (NSInteger)read:(uint8_t *)buffer + maxLength:(NSUInteger)length +{ + NSInteger totalNumberOfBytesRead = 0; + + if (_phase == AFEncapsulationBoundaryPhase) { + NSData *encapsulationBoundaryData = [([self hasInitialBoundary] ? AFMultipartFormInitialBoundary(self.boundary) : AFMultipartFormEncapsulationBoundary(self.boundary)) dataUsingEncoding:self.stringEncoding]; + totalNumberOfBytesRead += [self readData:encapsulationBoundaryData intoBuffer:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)]; + } + + if (_phase == AFHeaderPhase) { + NSData *headersData = [[self stringForHeaders] dataUsingEncoding:self.stringEncoding]; + totalNumberOfBytesRead += [self readData:headersData intoBuffer:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)]; + } + + if (_phase == AFBodyPhase) { + NSInteger numberOfBytesRead = 0; + + numberOfBytesRead = [self.inputStream read:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)]; + if (numberOfBytesRead == -1) { + return -1; + } else { + totalNumberOfBytesRead += numberOfBytesRead; + + if ([self.inputStream streamStatus] >= NSStreamStatusAtEnd) { + [self transitionToNextPhase]; + } + } + } + + if (_phase == AFFinalBoundaryPhase) { + NSData *closingBoundaryData = ([self hasFinalBoundary] ? [AFMultipartFormFinalBoundary(self.boundary) dataUsingEncoding:self.stringEncoding] : [NSData data]); + totalNumberOfBytesRead += [self readData:closingBoundaryData intoBuffer:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)]; + } + + return totalNumberOfBytesRead; +} + +- (NSInteger)readData:(NSData *)data + intoBuffer:(uint8_t *)buffer + maxLength:(NSUInteger)length +{ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu" + NSRange range = NSMakeRange((NSUInteger)_phaseReadOffset, MIN([data length] - ((NSUInteger)_phaseReadOffset), length)); + [data getBytes:buffer range:range]; +#pragma clang diagnostic pop + + _phaseReadOffset += range.length; + + if (((NSUInteger)_phaseReadOffset) >= [data length]) { + [self transitionToNextPhase]; + } + + return (NSInteger)range.length; +} + +- (BOOL)transitionToNextPhase { + if (![[NSThread currentThread] isMainThread]) { + dispatch_sync(dispatch_get_main_queue(), ^{ + [self transitionToNextPhase]; + }); + return YES; + } + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wcovered-switch-default" + switch (_phase) { + case AFEncapsulationBoundaryPhase: + _phase = AFHeaderPhase; + break; + case AFHeaderPhase: + [self.inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes]; + [self.inputStream open]; + _phase = AFBodyPhase; + break; + case AFBodyPhase: + [self.inputStream close]; + _phase = AFFinalBoundaryPhase; + break; + case AFFinalBoundaryPhase: + default: + _phase = AFEncapsulationBoundaryPhase; + break; + } + _phaseReadOffset = 0; +#pragma clang diagnostic pop + + return YES; +} + +#pragma mark - NSCopying + +- (instancetype)copyWithZone:(NSZone *)zone { + AFHTTPBodyPart *bodyPart = [[[self class] allocWithZone:zone] init]; + + bodyPart.stringEncoding = self.stringEncoding; + bodyPart.headers = self.headers; + bodyPart.bodyContentLength = self.bodyContentLength; + bodyPart.body = self.body; + bodyPart.boundary = self.boundary; + + return bodyPart; +} + +@end + +#pragma mark - + +@implementation AFJSONRequestSerializer + ++ (instancetype)serializer { + return [self serializerWithWritingOptions:(NSJSONWritingOptions)0]; +} + ++ (instancetype)serializerWithWritingOptions:(NSJSONWritingOptions)writingOptions +{ + AFJSONRequestSerializer *serializer = [[self alloc] init]; + serializer.writingOptions = writingOptions; + + return serializer; +} + +#pragma mark - AFURLRequestSerialization + +- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request + withParameters:(id)parameters + error:(NSError *__autoreleasing *)error +{ + NSParameterAssert(request); + + if ([self.HTTPMethodsEncodingParametersInURI containsObject:[[request HTTPMethod] uppercaseString]]) { + return [super requestBySerializingRequest:request withParameters:parameters error:error]; + } + + NSMutableURLRequest *mutableRequest = [request mutableCopy]; + + [self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(id field, id value, BOOL * __unused stop) { + if (![request valueForHTTPHeaderField:field]) { + [mutableRequest setValue:value forHTTPHeaderField:field]; + } + }]; + + if (parameters) { + if (![mutableRequest valueForHTTPHeaderField:@"Content-Type"]) { + [mutableRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; + } + + [mutableRequest setHTTPBody:[NSJSONSerialization dataWithJSONObject:parameters options:self.writingOptions error:error]]; + } + + return mutableRequest; +} + +#pragma mark - NSSecureCoding + +- (instancetype)initWithCoder:(NSCoder *)decoder { + self = [super initWithCoder:decoder]; + if (!self) { + return nil; + } + + self.writingOptions = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(writingOptions))] unsignedIntegerValue]; + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)coder { + [super encodeWithCoder:coder]; + + [coder encodeInteger:self.writingOptions forKey:NSStringFromSelector(@selector(writingOptions))]; +} + +#pragma mark - NSCopying + +- (instancetype)copyWithZone:(NSZone *)zone { + AFJSONRequestSerializer *serializer = [super copyWithZone:zone]; + serializer.writingOptions = self.writingOptions; + + return serializer; +} + +@end + +#pragma mark - + +@implementation AFPropertyListRequestSerializer + ++ (instancetype)serializer { + return [self serializerWithFormat:NSPropertyListXMLFormat_v1_0 writeOptions:0]; +} + ++ (instancetype)serializerWithFormat:(NSPropertyListFormat)format + writeOptions:(NSPropertyListWriteOptions)writeOptions +{ + AFPropertyListRequestSerializer *serializer = [[self alloc] init]; + serializer.format = format; + serializer.writeOptions = writeOptions; + + return serializer; +} + +#pragma mark - AFURLRequestSerializer + +- (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request + withParameters:(id)parameters + error:(NSError *__autoreleasing *)error +{ + NSParameterAssert(request); + + if ([self.HTTPMethodsEncodingParametersInURI containsObject:[[request HTTPMethod] uppercaseString]]) { + return [super requestBySerializingRequest:request withParameters:parameters error:error]; + } + + NSMutableURLRequest *mutableRequest = [request mutableCopy]; + + [self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(id field, id value, BOOL * __unused stop) { + if (![request valueForHTTPHeaderField:field]) { + [mutableRequest setValue:value forHTTPHeaderField:field]; + } + }]; + + if (parameters) { + if (![mutableRequest valueForHTTPHeaderField:@"Content-Type"]) { + [mutableRequest setValue:@"application/x-plist" forHTTPHeaderField:@"Content-Type"]; + } + + [mutableRequest setHTTPBody:[NSPropertyListSerialization dataWithPropertyList:parameters format:self.format options:self.writeOptions error:error]]; + } + + return mutableRequest; +} + +#pragma mark - NSSecureCoding + +- (instancetype)initWithCoder:(NSCoder *)decoder { + self = [super initWithCoder:decoder]; + if (!self) { + return nil; + } + + self.format = (NSPropertyListFormat)[[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(format))] unsignedIntegerValue]; + self.writeOptions = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(writeOptions))] unsignedIntegerValue]; + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)coder { + [super encodeWithCoder:coder]; + + [coder encodeInteger:self.format forKey:NSStringFromSelector(@selector(format))]; + [coder encodeObject:@(self.writeOptions) forKey:NSStringFromSelector(@selector(writeOptions))]; +} + +#pragma mark - NSCopying + +- (instancetype)copyWithZone:(NSZone *)zone { + AFPropertyListRequestSerializer *serializer = [super copyWithZone:zone]; + serializer.format = self.format; + serializer.writeOptions = self.writeOptions; + + return serializer; +} + +@end diff --git a/its/plugin/projects/AFNetworking/AFNetworking/AFURLResponseSerialization.h b/its/plugin/projects/AFNetworking/AFNetworking/AFURLResponseSerialization.h new file mode 100644 index 00000000..c1357aed --- /dev/null +++ b/its/plugin/projects/AFNetworking/AFNetworking/AFURLResponseSerialization.h @@ -0,0 +1,311 @@ +// AFURLResponseSerialization.h +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + The `AFURLResponseSerialization` protocol is adopted by an object that decodes data into a more useful object representation, according to details in the server response. Response serializers may additionally perform validation on the incoming response and data. + + For example, a JSON response serializer may check for an acceptable status code (`2XX` range) and content type (`application/json`), decoding a valid JSON response into an object. + */ +@protocol AFURLResponseSerialization + +/** + The response object decoded from the data associated with a specified response. + + @param response The response to be processed. + @param data The response data to be decoded. + @param error The error that occurred while attempting to decode the response data. + + @return The object decoded from the specified response data. + */ +- (nullable id)responseObjectForResponse:(nullable NSURLResponse *)response + data:(nullable NSData *)data + error:(NSError * _Nullable __autoreleasing *)error NS_SWIFT_NOTHROW; + +@end + +#pragma mark - + +/** + `AFHTTPResponseSerializer` conforms to the `AFURLRequestSerialization` & `AFURLResponseSerialization` protocols, offering a concrete base implementation of query string / URL form-encoded parameter serialization and default request headers, as well as response status code and content type validation. + + Any request or response serializer dealing with HTTP is encouraged to subclass `AFHTTPResponseSerializer` in order to ensure consistent default behavior. + */ +@interface AFHTTPResponseSerializer : NSObject + +- (instancetype)init; + +/** + The string encoding used to serialize data received from the server, when no string encoding is specified by the response. `NSUTF8StringEncoding` by default. + */ +@property (nonatomic, assign) NSStringEncoding stringEncoding; + +/** + Creates and returns a serializer with default configuration. + */ ++ (instancetype)serializer; + +///----------------------------------------- +/// @name Configuring Response Serialization +///----------------------------------------- + +/** + The acceptable HTTP status codes for responses. When non-`nil`, responses with status codes not contained by the set will result in an error during validation. + + See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html + */ +@property (nonatomic, copy, nullable) NSIndexSet *acceptableStatusCodes; + +/** + The acceptable MIME types for responses. When non-`nil`, responses with a `Content-Type` with MIME types that do not intersect with the set will result in an error during validation. + */ +@property (nonatomic, copy, nullable) NSSet *acceptableContentTypes; + +/** + Validates the specified response and data. + + In its base implementation, this method checks for an acceptable status code and content type. Subclasses may wish to add other domain-specific checks. + + @param response The response to be validated. + @param data The data associated with the response. + @param error The error that occurred while attempting to validate the response. + + @return `YES` if the response is valid, otherwise `NO`. + */ +- (BOOL)validateResponse:(nullable NSHTTPURLResponse *)response + data:(nullable NSData *)data + error:(NSError * _Nullable __autoreleasing *)error; + +@end + +#pragma mark - + + +/** + `AFJSONResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes JSON responses. + + By default, `AFJSONResponseSerializer` accepts the following MIME types, which includes the official standard, `application/json`, as well as other commonly-used types: + + - `application/json` + - `text/json` + - `text/javascript` + */ +@interface AFJSONResponseSerializer : AFHTTPResponseSerializer + +- (instancetype)init; + +/** + Options for reading the response JSON data and creating the Foundation objects. For possible values, see the `NSJSONSerialization` documentation section "NSJSONReadingOptions". `0` by default. + */ +@property (nonatomic, assign) NSJSONReadingOptions readingOptions; + +/** + Whether to remove keys with `NSNull` values from response JSON. Defaults to `NO`. + */ +@property (nonatomic, assign) BOOL removesKeysWithNullValues; + +/** + Creates and returns a JSON serializer with specified reading and writing options. + + @param readingOptions The specified JSON reading options. + */ ++ (instancetype)serializerWithReadingOptions:(NSJSONReadingOptions)readingOptions; + +@end + +#pragma mark - + +/** + `AFXMLParserResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes XML responses as an `NSXMLParser` objects. + + By default, `AFXMLParserResponseSerializer` accepts the following MIME types, which includes the official standard, `application/xml`, as well as other commonly-used types: + + - `application/xml` + - `text/xml` + */ +@interface AFXMLParserResponseSerializer : AFHTTPResponseSerializer + +@end + +#pragma mark - + +#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED + +/** + `AFXMLDocumentResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes XML responses as an `NSXMLDocument` objects. + + By default, `AFXMLDocumentResponseSerializer` accepts the following MIME types, which includes the official standard, `application/xml`, as well as other commonly-used types: + + - `application/xml` + - `text/xml` + */ +@interface AFXMLDocumentResponseSerializer : AFHTTPResponseSerializer + +- (instancetype)init; + +/** + Input and output options specifically intended for `NSXMLDocument` objects. For possible values, see the `NSJSONSerialization` documentation section "NSJSONReadingOptions". `0` by default. + */ +@property (nonatomic, assign) NSUInteger options; + +/** + Creates and returns an XML document serializer with the specified options. + + @param mask The XML document options. + */ ++ (instancetype)serializerWithXMLDocumentOptions:(NSUInteger)mask; + +@end + +#endif + +#pragma mark - + +/** + `AFPropertyListResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes XML responses as an `NSXMLDocument` objects. + + By default, `AFPropertyListResponseSerializer` accepts the following MIME types: + + - `application/x-plist` + */ +@interface AFPropertyListResponseSerializer : AFHTTPResponseSerializer + +- (instancetype)init; + +/** + The property list format. Possible values are described in "NSPropertyListFormat". + */ +@property (nonatomic, assign) NSPropertyListFormat format; + +/** + The property list reading options. Possible values are described in "NSPropertyListMutabilityOptions." + */ +@property (nonatomic, assign) NSPropertyListReadOptions readOptions; + +/** + Creates and returns a property list serializer with a specified format, read options, and write options. + + @param format The property list format. + @param readOptions The property list reading options. + */ ++ (instancetype)serializerWithFormat:(NSPropertyListFormat)format + readOptions:(NSPropertyListReadOptions)readOptions; + +@end + +#pragma mark - + +/** + `AFImageResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes image responses. + + By default, `AFImageResponseSerializer` accepts the following MIME types, which correspond to the image formats supported by UIImage or NSImage: + + - `image/tiff` + - `image/jpeg` + - `image/gif` + - `image/png` + - `image/ico` + - `image/x-icon` + - `image/bmp` + - `image/x-bmp` + - `image/x-xbitmap` + - `image/x-win-bitmap` + */ +@interface AFImageResponseSerializer : AFHTTPResponseSerializer + +#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH +/** + The scale factor used when interpreting the image data to construct `responseImage`. Specifying a scale factor of 1.0 results in an image whose size matches the pixel-based dimensions of the image. Applying a different scale factor changes the size of the image as reported by the size property. This is set to the value of scale of the main screen by default, which automatically scales images for retina displays, for instance. + */ +@property (nonatomic, assign) CGFloat imageScale; + +/** + Whether to automatically inflate response image data for compressed formats (such as PNG or JPEG). Enabling this can significantly improve drawing performance on iOS when used with `setCompletionBlockWithSuccess:failure:`, as it allows a bitmap representation to be constructed in the background rather than on the main thread. `YES` by default. + */ +@property (nonatomic, assign) BOOL automaticallyInflatesResponseImage; +#endif + +@end + +#pragma mark - + +/** + `AFCompoundSerializer` is a subclass of `AFHTTPResponseSerializer` that delegates the response serialization to the first `AFHTTPResponseSerializer` object that returns an object for `responseObjectForResponse:data:error:`, falling back on the default behavior of `AFHTTPResponseSerializer`. This is useful for supporting multiple potential types and structures of server responses with a single serializer. + */ +@interface AFCompoundResponseSerializer : AFHTTPResponseSerializer + +/** + The component response serializers. + */ +@property (readonly, nonatomic, copy) NSArray > *responseSerializers; + +/** + Creates and returns a compound serializer comprised of the specified response serializers. + + @warning Each response serializer specified must be a subclass of `AFHTTPResponseSerializer`, and response to `-validateResponse:data:error:`. + */ ++ (instancetype)compoundSerializerWithResponseSerializers:(NSArray > *)responseSerializers; + +@end + +///---------------- +/// @name Constants +///---------------- + +/** + ## Error Domains + + The following error domain is predefined. + + - `NSString * const AFURLResponseSerializationErrorDomain` + + ### Constants + + `AFURLResponseSerializationErrorDomain` + AFURLResponseSerializer errors. Error codes for `AFURLResponseSerializationErrorDomain` correspond to codes in `NSURLErrorDomain`. + */ +FOUNDATION_EXPORT NSString * const AFURLResponseSerializationErrorDomain; + +/** + ## User info dictionary keys + + These keys may exist in the user info dictionary, in addition to those defined for NSError. + + - `NSString * const AFNetworkingOperationFailingURLResponseErrorKey` + - `NSString * const AFNetworkingOperationFailingURLResponseDataErrorKey` + + ### Constants + + `AFNetworkingOperationFailingURLResponseErrorKey` + The corresponding value is an `NSURLResponse` containing the response of the operation associated with an error. This key is only present in the `AFURLResponseSerializationErrorDomain`. + + `AFNetworkingOperationFailingURLResponseDataErrorKey` + The corresponding value is an `NSData` containing the original data of the operation associated with an error. This key is only present in the `AFURLResponseSerializationErrorDomain`. + */ +FOUNDATION_EXPORT NSString * const AFNetworkingOperationFailingURLResponseErrorKey; + +FOUNDATION_EXPORT NSString * const AFNetworkingOperationFailingURLResponseDataErrorKey; + +NS_ASSUME_NONNULL_END diff --git a/its/plugin/projects/AFNetworking/AFNetworking/AFURLResponseSerialization.m b/its/plugin/projects/AFNetworking/AFNetworking/AFURLResponseSerialization.m new file mode 100755 index 00000000..1402e8d3 --- /dev/null +++ b/its/plugin/projects/AFNetworking/AFNetworking/AFURLResponseSerialization.m @@ -0,0 +1,803 @@ +// AFURLResponseSerialization.m +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "AFURLResponseSerialization.h" + +#import + +#if TARGET_OS_IOS +#import +#elif TARGET_OS_WATCH +#import +#elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) +#import +#endif + +NSString * const AFURLResponseSerializationErrorDomain = @"com.alamofire.error.serialization.response"; +NSString * const AFNetworkingOperationFailingURLResponseErrorKey = @"com.alamofire.serialization.response.error.response"; +NSString * const AFNetworkingOperationFailingURLResponseDataErrorKey = @"com.alamofire.serialization.response.error.data"; + +static NSError * AFErrorWithUnderlyingError(NSError *error, NSError *underlyingError) { + if (!error) { + return underlyingError; + } + + if (!underlyingError || error.userInfo[NSUnderlyingErrorKey]) { + return error; + } + + NSMutableDictionary *mutableUserInfo = [error.userInfo mutableCopy]; + mutableUserInfo[NSUnderlyingErrorKey] = underlyingError; + + return [[NSError alloc] initWithDomain:error.domain code:error.code userInfo:mutableUserInfo]; +} + +static BOOL AFErrorOrUnderlyingErrorHasCodeInDomain(NSError *error, NSInteger code, NSString *domain) { + if ([error.domain isEqualToString:domain] && error.code == code) { + return YES; + } else if (error.userInfo[NSUnderlyingErrorKey]) { + return AFErrorOrUnderlyingErrorHasCodeInDomain(error.userInfo[NSUnderlyingErrorKey], code, domain); + } + + return NO; +} + +static id AFJSONObjectByRemovingKeysWithNullValues(id JSONObject, NSJSONReadingOptions readingOptions) { + if ([JSONObject isKindOfClass:[NSArray class]]) { + NSMutableArray *mutableArray = [NSMutableArray arrayWithCapacity:[(NSArray *)JSONObject count]]; + for (id value in (NSArray *)JSONObject) { + [mutableArray addObject:AFJSONObjectByRemovingKeysWithNullValues(value, readingOptions)]; + } + + return (readingOptions & NSJSONReadingMutableContainers) ? mutableArray : [NSArray arrayWithArray:mutableArray]; + } else if ([JSONObject isKindOfClass:[NSDictionary class]]) { + NSMutableDictionary *mutableDictionary = [NSMutableDictionary dictionaryWithDictionary:JSONObject]; + for (id key in [(NSDictionary *)JSONObject allKeys]) { + id value = (NSDictionary *)JSONObject[key]; + if (!value || [value isEqual:[NSNull null]]) { + [mutableDictionary removeObjectForKey:key]; + } else if ([value isKindOfClass:[NSArray class]] || [value isKindOfClass:[NSDictionary class]]) { + mutableDictionary[key] = AFJSONObjectByRemovingKeysWithNullValues(value, readingOptions); + } + } + + return (readingOptions & NSJSONReadingMutableContainers) ? mutableDictionary : [NSDictionary dictionaryWithDictionary:mutableDictionary]; + } + + return JSONObject; +} + +@implementation AFHTTPResponseSerializer + ++ (instancetype)serializer { + return [[self alloc] init]; +} + +- (instancetype)init { + self = [super init]; + if (!self) { + return nil; + } + + self.stringEncoding = NSUTF8StringEncoding; + + self.acceptableStatusCodes = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(200, 100)]; + self.acceptableContentTypes = nil; + + return self; +} + +#pragma mark - + +- (BOOL)validateResponse:(NSHTTPURLResponse *)response + data:(NSData *)data + error:(NSError * __autoreleasing *)error +{ + BOOL responseIsValid = YES; + NSError *validationError = nil; + + if (response && [response isKindOfClass:[NSHTTPURLResponse class]]) { + if (self.acceptableContentTypes && ![self.acceptableContentTypes containsObject:[response MIMEType]]) { + if ([data length] > 0 && [response URL]) { + NSMutableDictionary *mutableUserInfo = [@{ + NSLocalizedDescriptionKey: [NSString stringWithFormat:NSLocalizedStringFromTable(@"Request failed: unacceptable content-type: %@", @"AFNetworking", nil), [response MIMEType]], + NSURLErrorFailingURLErrorKey:[response URL], + AFNetworkingOperationFailingURLResponseErrorKey: response, + } mutableCopy]; + if (data) { + mutableUserInfo[AFNetworkingOperationFailingURLResponseDataErrorKey] = data; + } + + validationError = AFErrorWithUnderlyingError([NSError errorWithDomain:AFURLResponseSerializationErrorDomain code:NSURLErrorCannotDecodeContentData userInfo:mutableUserInfo], validationError); + } + + responseIsValid = NO; + } + + if (self.acceptableStatusCodes && ![self.acceptableStatusCodes containsIndex:(NSUInteger)response.statusCode] && [response URL]) { + NSMutableDictionary *mutableUserInfo = [@{ + NSLocalizedDescriptionKey: [NSString stringWithFormat:NSLocalizedStringFromTable(@"Request failed: %@ (%ld)", @"AFNetworking", nil), [NSHTTPURLResponse localizedStringForStatusCode:response.statusCode], (long)response.statusCode], + NSURLErrorFailingURLErrorKey:[response URL], + AFNetworkingOperationFailingURLResponseErrorKey: response, + } mutableCopy]; + + if (data) { + mutableUserInfo[AFNetworkingOperationFailingURLResponseDataErrorKey] = data; + } + + validationError = AFErrorWithUnderlyingError([NSError errorWithDomain:AFURLResponseSerializationErrorDomain code:NSURLErrorBadServerResponse userInfo:mutableUserInfo], validationError); + + responseIsValid = NO; + } + } + + if (error && !responseIsValid) { + *error = validationError; + } + + return responseIsValid; +} + +#pragma mark - AFURLResponseSerialization + +- (id)responseObjectForResponse:(NSURLResponse *)response + data:(NSData *)data + error:(NSError *__autoreleasing *)error +{ + [self validateResponse:(NSHTTPURLResponse *)response data:data error:error]; + + return data; +} + +#pragma mark - NSSecureCoding + ++ (BOOL)supportsSecureCoding { + return YES; +} + +- (instancetype)initWithCoder:(NSCoder *)decoder { + self = [self init]; + if (!self) { + return nil; + } + + self.acceptableStatusCodes = [decoder decodeObjectOfClass:[NSIndexSet class] forKey:NSStringFromSelector(@selector(acceptableStatusCodes))]; + self.acceptableContentTypes = [decoder decodeObjectOfClass:[NSIndexSet class] forKey:NSStringFromSelector(@selector(acceptableContentTypes))]; + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)coder { + [coder encodeObject:self.acceptableStatusCodes forKey:NSStringFromSelector(@selector(acceptableStatusCodes))]; + [coder encodeObject:self.acceptableContentTypes forKey:NSStringFromSelector(@selector(acceptableContentTypes))]; +} + +#pragma mark - NSCopying + +- (instancetype)copyWithZone:(NSZone *)zone { + AFHTTPResponseSerializer *serializer = [[[self class] allocWithZone:zone] init]; + serializer.acceptableStatusCodes = [self.acceptableStatusCodes copyWithZone:zone]; + serializer.acceptableContentTypes = [self.acceptableContentTypes copyWithZone:zone]; + + return serializer; +} + +@end + +#pragma mark - + +@implementation AFJSONResponseSerializer + ++ (instancetype)serializer { + return [self serializerWithReadingOptions:(NSJSONReadingOptions)0]; +} + ++ (instancetype)serializerWithReadingOptions:(NSJSONReadingOptions)readingOptions { + AFJSONResponseSerializer *serializer = [[self alloc] init]; + serializer.readingOptions = readingOptions; + + return serializer; +} + +- (instancetype)init { + self = [super init]; + if (!self) { + return nil; + } + + self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", nil]; + + return self; +} + +#pragma mark - AFURLResponseSerialization + +- (id)responseObjectForResponse:(NSURLResponse *)response + data:(NSData *)data + error:(NSError *__autoreleasing *)error +{ + if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) { + if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) { + return nil; + } + } + + id responseObject = nil; + NSError *serializationError = nil; + // Workaround for behavior of Rails to return a single space for `head :ok` (a workaround for a bug in Safari), which is not interpreted as valid input by NSJSONSerialization. + // See https://github.com/rails/rails/issues/1742 + BOOL isSpace = [data isEqualToData:[NSData dataWithBytes:" " length:1]]; + if (data.length > 0 && !isSpace) { + responseObject = [NSJSONSerialization JSONObjectWithData:data options:self.readingOptions error:&serializationError]; + } else { + return nil; + } + + if (self.removesKeysWithNullValues && responseObject) { + responseObject = AFJSONObjectByRemovingKeysWithNullValues(responseObject, self.readingOptions); + } + + if (error) { + *error = AFErrorWithUnderlyingError(serializationError, *error); + } + + return responseObject; +} + +#pragma mark - NSSecureCoding + +- (instancetype)initWithCoder:(NSCoder *)decoder { + self = [super initWithCoder:decoder]; + if (!self) { + return nil; + } + + self.readingOptions = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(readingOptions))] unsignedIntegerValue]; + self.removesKeysWithNullValues = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(removesKeysWithNullValues))] boolValue]; + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)coder { + [super encodeWithCoder:coder]; + + [coder encodeObject:@(self.readingOptions) forKey:NSStringFromSelector(@selector(readingOptions))]; + [coder encodeObject:@(self.removesKeysWithNullValues) forKey:NSStringFromSelector(@selector(removesKeysWithNullValues))]; +} + +#pragma mark - NSCopying + +- (instancetype)copyWithZone:(NSZone *)zone { + AFJSONResponseSerializer *serializer = [[[self class] allocWithZone:zone] init]; + serializer.readingOptions = self.readingOptions; + serializer.removesKeysWithNullValues = self.removesKeysWithNullValues; + + return serializer; +} + +@end + +#pragma mark - + +@implementation AFXMLParserResponseSerializer + ++ (instancetype)serializer { + AFXMLParserResponseSerializer *serializer = [[self alloc] init]; + + return serializer; +} + +- (instancetype)init { + self = [super init]; + if (!self) { + return nil; + } + + self.acceptableContentTypes = [[NSSet alloc] initWithObjects:@"application/xml", @"text/xml", nil]; + + return self; +} + +#pragma mark - AFURLResponseSerialization + +- (id)responseObjectForResponse:(NSHTTPURLResponse *)response + data:(NSData *)data + error:(NSError *__autoreleasing *)error +{ + if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) { + if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) { + return nil; + } + } + + return [[NSXMLParser alloc] initWithData:data]; +} + +@end + +#pragma mark - + +#ifdef __MAC_OS_X_VERSION_MIN_REQUIRED + +@implementation AFXMLDocumentResponseSerializer + ++ (instancetype)serializer { + return [self serializerWithXMLDocumentOptions:0]; +} + ++ (instancetype)serializerWithXMLDocumentOptions:(NSUInteger)mask { + AFXMLDocumentResponseSerializer *serializer = [[self alloc] init]; + serializer.options = mask; + + return serializer; +} + +- (instancetype)init { + self = [super init]; + if (!self) { + return nil; + } + + self.acceptableContentTypes = [[NSSet alloc] initWithObjects:@"application/xml", @"text/xml", nil]; + + return self; +} + +#pragma mark - AFURLResponseSerialization + +- (id)responseObjectForResponse:(NSURLResponse *)response + data:(NSData *)data + error:(NSError *__autoreleasing *)error +{ + if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) { + if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) { + return nil; + } + } + + NSError *serializationError = nil; + NSXMLDocument *document = [[NSXMLDocument alloc] initWithData:data options:self.options error:&serializationError]; + + if (error) { + *error = AFErrorWithUnderlyingError(serializationError, *error); + } + + return document; +} + +#pragma mark - NSSecureCoding + +- (instancetype)initWithCoder:(NSCoder *)decoder { + self = [super initWithCoder:decoder]; + if (!self) { + return nil; + } + + self.options = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(options))] unsignedIntegerValue]; + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)coder { + [super encodeWithCoder:coder]; + + [coder encodeObject:@(self.options) forKey:NSStringFromSelector(@selector(options))]; +} + +#pragma mark - NSCopying + +- (instancetype)copyWithZone:(NSZone *)zone { + AFXMLDocumentResponseSerializer *serializer = [[[self class] allocWithZone:zone] init]; + serializer.options = self.options; + + return serializer; +} + +@end + +#endif + +#pragma mark - + +@implementation AFPropertyListResponseSerializer + ++ (instancetype)serializer { + return [self serializerWithFormat:NSPropertyListXMLFormat_v1_0 readOptions:0]; +} + ++ (instancetype)serializerWithFormat:(NSPropertyListFormat)format + readOptions:(NSPropertyListReadOptions)readOptions +{ + AFPropertyListResponseSerializer *serializer = [[self alloc] init]; + serializer.format = format; + serializer.readOptions = readOptions; + + return serializer; +} + +- (instancetype)init { + self = [super init]; + if (!self) { + return nil; + } + + self.acceptableContentTypes = [[NSSet alloc] initWithObjects:@"application/x-plist", nil]; + + return self; +} + +#pragma mark - AFURLResponseSerialization + +- (id)responseObjectForResponse:(NSURLResponse *)response + data:(NSData *)data + error:(NSError *__autoreleasing *)error +{ + if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) { + if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) { + return nil; + } + } + + id responseObject; + NSError *serializationError = nil; + + if (data) { + responseObject = [NSPropertyListSerialization propertyListWithData:data options:self.readOptions format:NULL error:&serializationError]; + } + + if (error) { + *error = AFErrorWithUnderlyingError(serializationError, *error); + } + + return responseObject; +} + +#pragma mark - NSSecureCoding + +- (instancetype)initWithCoder:(NSCoder *)decoder { + self = [super initWithCoder:decoder]; + if (!self) { + return nil; + } + + self.format = (NSPropertyListFormat)[[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(format))] unsignedIntegerValue]; + self.readOptions = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(readOptions))] unsignedIntegerValue]; + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)coder { + [super encodeWithCoder:coder]; + + [coder encodeObject:@(self.format) forKey:NSStringFromSelector(@selector(format))]; + [coder encodeObject:@(self.readOptions) forKey:NSStringFromSelector(@selector(readOptions))]; +} + +#pragma mark - NSCopying + +- (instancetype)copyWithZone:(NSZone *)zone { + AFPropertyListResponseSerializer *serializer = [[[self class] allocWithZone:zone] init]; + serializer.format = self.format; + serializer.readOptions = self.readOptions; + + return serializer; +} + +@end + +#pragma mark - + +#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH +#import +#import + +@interface UIImage (AFNetworkingSafeImageLoading) ++ (UIImage *)af_safeImageWithData:(NSData *)data; +@end + +static NSLock* imageLock = nil; + +@implementation UIImage (AFNetworkingSafeImageLoading) + ++ (UIImage *)af_safeImageWithData:(NSData *)data { + UIImage* image = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + imageLock = [[NSLock alloc] init]; + }); + + [imageLock lock]; + image = [UIImage imageWithData:data]; + [imageLock unlock]; + return image; +} + +@end + +static UIImage * AFImageWithDataAtScale(NSData *data, CGFloat scale) { + UIImage *image = [UIImage af_safeImageWithData:data]; + if (image.images) { + return image; + } + + return [[UIImage alloc] initWithCGImage:[image CGImage] scale:scale orientation:image.imageOrientation]; +} + +static UIImage * AFInflatedImageFromResponseWithDataAtScale(NSHTTPURLResponse *response, NSData *data, CGFloat scale) { + if (!data || [data length] == 0) { + return nil; + } + + CGImageRef imageRef = NULL; + CGDataProviderRef dataProvider = CGDataProviderCreateWithCFData((__bridge CFDataRef)data); + + if ([response.MIMEType isEqualToString:@"image/png"]) { + imageRef = CGImageCreateWithPNGDataProvider(dataProvider, NULL, true, kCGRenderingIntentDefault); + } else if ([response.MIMEType isEqualToString:@"image/jpeg"]) { + imageRef = CGImageCreateWithJPEGDataProvider(dataProvider, NULL, true, kCGRenderingIntentDefault); + + if (imageRef) { + CGColorSpaceRef imageColorSpace = CGImageGetColorSpace(imageRef); + CGColorSpaceModel imageColorSpaceModel = CGColorSpaceGetModel(imageColorSpace); + + // CGImageCreateWithJPEGDataProvider does not properly handle CMKY, so fall back to AFImageWithDataAtScale + if (imageColorSpaceModel == kCGColorSpaceModelCMYK) { + CGImageRelease(imageRef); + imageRef = NULL; + } + } + } + + CGDataProviderRelease(dataProvider); + + UIImage *image = AFImageWithDataAtScale(data, scale); + if (!imageRef) { + if (image.images || !image) { + return image; + } + + imageRef = CGImageCreateCopy([image CGImage]); + if (!imageRef) { + return nil; + } + } + + size_t width = CGImageGetWidth(imageRef); + size_t height = CGImageGetHeight(imageRef); + size_t bitsPerComponent = CGImageGetBitsPerComponent(imageRef); + + if (width * height > 1024 * 1024 || bitsPerComponent > 8) { + CGImageRelease(imageRef); + + return image; + } + + // CGImageGetBytesPerRow() calculates incorrectly in iOS 5.0, so defer to CGBitmapContextCreate + size_t bytesPerRow = 0; + CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); + CGColorSpaceModel colorSpaceModel = CGColorSpaceGetModel(colorSpace); + CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef); + + if (colorSpaceModel == kCGColorSpaceModelRGB) { + uint32_t alpha = (bitmapInfo & kCGBitmapAlphaInfoMask); +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wassign-enum" + if (alpha == kCGImageAlphaNone) { + bitmapInfo &= ~kCGBitmapAlphaInfoMask; + bitmapInfo |= kCGImageAlphaNoneSkipFirst; + } else if (!(alpha == kCGImageAlphaNoneSkipFirst || alpha == kCGImageAlphaNoneSkipLast)) { + bitmapInfo &= ~kCGBitmapAlphaInfoMask; + bitmapInfo |= kCGImageAlphaPremultipliedFirst; + } +#pragma clang diagnostic pop + } + + CGContextRef context = CGBitmapContextCreate(NULL, width, height, bitsPerComponent, bytesPerRow, colorSpace, bitmapInfo); + + CGColorSpaceRelease(colorSpace); + + if (!context) { + CGImageRelease(imageRef); + + return image; + } + + CGContextDrawImage(context, CGRectMake(0.0f, 0.0f, width, height), imageRef); + CGImageRef inflatedImageRef = CGBitmapContextCreateImage(context); + + CGContextRelease(context); + + UIImage *inflatedImage = [[UIImage alloc] initWithCGImage:inflatedImageRef scale:scale orientation:image.imageOrientation]; + + CGImageRelease(inflatedImageRef); + CGImageRelease(imageRef); + + return inflatedImage; +} +#endif + + +@implementation AFImageResponseSerializer + +- (instancetype)init { + self = [super init]; + if (!self) { + return nil; + } + + self.acceptableContentTypes = [[NSSet alloc] initWithObjects:@"image/tiff", @"image/jpeg", @"image/gif", @"image/png", @"image/ico", @"image/x-icon", @"image/bmp", @"image/x-bmp", @"image/x-xbitmap", @"image/x-win-bitmap", nil]; + +#if TARGET_OS_IOS || TARGET_OS_TV + self.imageScale = [[UIScreen mainScreen] scale]; + self.automaticallyInflatesResponseImage = YES; +#elif TARGET_OS_WATCH + self.imageScale = [[WKInterfaceDevice currentDevice] screenScale]; + self.automaticallyInflatesResponseImage = YES; +#endif + + return self; +} + +#pragma mark - AFURLResponseSerializer + +- (id)responseObjectForResponse:(NSURLResponse *)response + data:(NSData *)data + error:(NSError *__autoreleasing *)error +{ + if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) { + if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) { + return nil; + } + } + +#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH + if (self.automaticallyInflatesResponseImage) { + return AFInflatedImageFromResponseWithDataAtScale((NSHTTPURLResponse *)response, data, self.imageScale); + } else { + return AFImageWithDataAtScale(data, self.imageScale); + } +#else + // Ensure that the image is set to it's correct pixel width and height + NSBitmapImageRep *bitimage = [[NSBitmapImageRep alloc] initWithData:data]; + NSImage *image = [[NSImage alloc] initWithSize:NSMakeSize([bitimage pixelsWide], [bitimage pixelsHigh])]; + [image addRepresentation:bitimage]; + + return image; +#endif + + return nil; +} + +#pragma mark - NSSecureCoding + +- (instancetype)initWithCoder:(NSCoder *)decoder { + self = [super initWithCoder:decoder]; + if (!self) { + return nil; + } + +#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH + NSNumber *imageScale = [decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(imageScale))]; +#if CGFLOAT_IS_DOUBLE + self.imageScale = [imageScale doubleValue]; +#else + self.imageScale = [imageScale floatValue]; +#endif + + self.automaticallyInflatesResponseImage = [decoder decodeBoolForKey:NSStringFromSelector(@selector(automaticallyInflatesResponseImage))]; +#endif + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)coder { + [super encodeWithCoder:coder]; + +#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH + [coder encodeObject:@(self.imageScale) forKey:NSStringFromSelector(@selector(imageScale))]; + [coder encodeBool:self.automaticallyInflatesResponseImage forKey:NSStringFromSelector(@selector(automaticallyInflatesResponseImage))]; +#endif +} + +#pragma mark - NSCopying + +- (instancetype)copyWithZone:(NSZone *)zone { + AFImageResponseSerializer *serializer = [[[self class] allocWithZone:zone] init]; + +#if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH + serializer.imageScale = self.imageScale; + serializer.automaticallyInflatesResponseImage = self.automaticallyInflatesResponseImage; +#endif + + return serializer; +} + +@end + +#pragma mark - + +@interface AFCompoundResponseSerializer () +@property (readwrite, nonatomic, copy) NSArray *responseSerializers; +@end + +@implementation AFCompoundResponseSerializer + ++ (instancetype)compoundSerializerWithResponseSerializers:(NSArray *)responseSerializers { + AFCompoundResponseSerializer *serializer = [[self alloc] init]; + serializer.responseSerializers = responseSerializers; + + return serializer; +} + +#pragma mark - AFURLResponseSerialization + +- (id)responseObjectForResponse:(NSURLResponse *)response + data:(NSData *)data + error:(NSError *__autoreleasing *)error +{ + for (id serializer in self.responseSerializers) { + if (![serializer isKindOfClass:[AFHTTPResponseSerializer class]]) { + continue; + } + + NSError *serializerError = nil; + id responseObject = [serializer responseObjectForResponse:response data:data error:&serializerError]; + if (responseObject) { + if (error) { + *error = AFErrorWithUnderlyingError(serializerError, *error); + } + + return responseObject; + } + } + + return [super responseObjectForResponse:response data:data error:error]; +} + +#pragma mark - NSSecureCoding + +- (instancetype)initWithCoder:(NSCoder *)decoder { + self = [super initWithCoder:decoder]; + if (!self) { + return nil; + } + + self.responseSerializers = [decoder decodeObjectOfClass:[NSArray class] forKey:NSStringFromSelector(@selector(responseSerializers))]; + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)coder { + [super encodeWithCoder:coder]; + + [coder encodeObject:self.responseSerializers forKey:NSStringFromSelector(@selector(responseSerializers))]; +} + +#pragma mark - NSCopying + +- (instancetype)copyWithZone:(NSZone *)zone { + AFCompoundResponseSerializer *serializer = [[[self class] allocWithZone:zone] init]; + serializer.responseSerializers = self.responseSerializers; + + return serializer; +} + +@end diff --git a/its/plugin/projects/AFNetworking/AFNetworking/AFURLSessionManager.h b/its/plugin/projects/AFNetworking/AFNetworking/AFURLSessionManager.h new file mode 100644 index 00000000..691e80c8 --- /dev/null +++ b/its/plugin/projects/AFNetworking/AFNetworking/AFURLSessionManager.h @@ -0,0 +1,499 @@ +// AFURLSessionManager.h +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + + +#import + +#import "AFURLResponseSerialization.h" +#import "AFURLRequestSerialization.h" +#import "AFSecurityPolicy.h" +#if !TARGET_OS_WATCH +#import "AFNetworkReachabilityManager.h" +#endif + +/** + `AFURLSessionManager` creates and manages an `NSURLSession` object based on a specified `NSURLSessionConfiguration` object, which conforms to ``, ``, ``, and ``. + + ## Subclassing Notes + + This is the base class for `AFHTTPSessionManager`, which adds functionality specific to making HTTP requests. If you are looking to extend `AFURLSessionManager` specifically for HTTP, consider subclassing `AFHTTPSessionManager` instead. + + ## NSURLSession & NSURLSessionTask Delegate Methods + + `AFURLSessionManager` implements the following delegate methods: + + ### `NSURLSessionDelegate` + + - `URLSession:didBecomeInvalidWithError:` + - `URLSession:didReceiveChallenge:completionHandler:` + - `URLSessionDidFinishEventsForBackgroundURLSession:` + + ### `NSURLSessionTaskDelegate` + + - `URLSession:willPerformHTTPRedirection:newRequest:completionHandler:` + - `URLSession:task:didReceiveChallenge:completionHandler:` + - `URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:` + - `URLSession:task:didCompleteWithError:` + + ### `NSURLSessionDataDelegate` + + - `URLSession:dataTask:didReceiveResponse:completionHandler:` + - `URLSession:dataTask:didBecomeDownloadTask:` + - `URLSession:dataTask:didReceiveData:` + - `URLSession:dataTask:willCacheResponse:completionHandler:` + + ### `NSURLSessionDownloadDelegate` + + - `URLSession:downloadTask:didFinishDownloadingToURL:` + - `URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesWritten:totalBytesExpectedToWrite:` + - `URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:` + + If any of these methods are overridden in a subclass, they _must_ call the `super` implementation first. + + ## Network Reachability Monitoring + + Network reachability status and change monitoring is available through the `reachabilityManager` property. Applications may choose to monitor network reachability conditions in order to prevent or suspend any outbound requests. See `AFNetworkReachabilityManager` for more details. + + ## NSCoding Caveats + + - Encoded managers do not include any block properties. Be sure to set delegate callback blocks when using `-initWithCoder:` or `NSKeyedUnarchiver`. + + ## NSCopying Caveats + + - `-copy` and `-copyWithZone:` return a new manager with a new `NSURLSession` created from the configuration of the original. + - Operation copies do not include any delegate callback blocks, as they often strongly captures a reference to `self`, which would otherwise have the unintuitive side-effect of pointing to the _original_ session manager when copied. + + @warning Managers for background sessions must be owned for the duration of their use. This can be accomplished by creating an application-wide or shared singleton instance. + */ + +NS_ASSUME_NONNULL_BEGIN + +@interface AFURLSessionManager : NSObject + +/** + The managed session. + */ +@property (readonly, nonatomic, strong) NSURLSession *session; + +/** + The operation queue on which delegate callbacks are run. + */ +@property (readonly, nonatomic, strong) NSOperationQueue *operationQueue; + +/** + Responses sent from the server in data tasks created with `dataTaskWithRequest:success:failure:` and run using the `GET` / `POST` / et al. convenience methods are automatically validated and serialized by the response serializer. By default, this property is set to an instance of `AFJSONResponseSerializer`. + + @warning `responseSerializer` must not be `nil`. + */ +@property (nonatomic, strong) id responseSerializer; + +///------------------------------- +/// @name Managing Security Policy +///------------------------------- + +/** + The security policy used by created session to evaluate server trust for secure connections. `AFURLSessionManager` uses the `defaultPolicy` unless otherwise specified. + */ +@property (nonatomic, strong) AFSecurityPolicy *securityPolicy; + +#if !TARGET_OS_WATCH +///-------------------------------------- +/// @name Monitoring Network Reachability +///-------------------------------------- + +/** + The network reachability manager. `AFURLSessionManager` uses the `sharedManager` by default. + */ +@property (readwrite, nonatomic, strong) AFNetworkReachabilityManager *reachabilityManager; +#endif + +///---------------------------- +/// @name Getting Session Tasks +///---------------------------- + +/** + The data, upload, and download tasks currently run by the managed session. + */ +@property (readonly, nonatomic, strong) NSArray *tasks; + +/** + The data tasks currently run by the managed session. + */ +@property (readonly, nonatomic, strong) NSArray *dataTasks; + +/** + The upload tasks currently run by the managed session. + */ +@property (readonly, nonatomic, strong) NSArray *uploadTasks; + +/** + The download tasks currently run by the managed session. + */ +@property (readonly, nonatomic, strong) NSArray *downloadTasks; + +///------------------------------- +/// @name Managing Callback Queues +///------------------------------- + +/** + The dispatch queue for `completionBlock`. If `NULL` (default), the main queue is used. + */ +@property (nonatomic, strong, nullable) dispatch_queue_t completionQueue; + +/** + The dispatch group for `completionBlock`. If `NULL` (default), a private dispatch group is used. + */ +@property (nonatomic, strong, nullable) dispatch_group_t completionGroup; + +///--------------------------------- +/// @name Working Around System Bugs +///--------------------------------- + +/** + Whether to attempt to retry creation of upload tasks for background sessions when initial call returns `nil`. `NO` by default. + + @bug As of iOS 7.0, there is a bug where upload tasks created for background tasks are sometimes `nil`. As a workaround, if this property is `YES`, AFNetworking will follow Apple's recommendation to try creating the task again. + + @see https://github.com/AFNetworking/AFNetworking/issues/1675 + */ +@property (nonatomic, assign) BOOL attemptsToRecreateUploadTasksForBackgroundSessions; + +///--------------------- +/// @name Initialization +///--------------------- + +/** + Creates and returns a manager for a session created with the specified configuration. This is the designated initializer. + + @param configuration The configuration used to create the managed session. + + @return A manager for a newly-created session. + */ +- (instancetype)initWithSessionConfiguration:(nullable NSURLSessionConfiguration *)configuration NS_DESIGNATED_INITIALIZER; + +/** + Invalidates the managed session, optionally canceling pending tasks. + + @param cancelPendingTasks Whether or not to cancel pending tasks. + */ +- (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks; + +///------------------------- +/// @name Running Data Tasks +///------------------------- + +/** + Creates an `NSURLSessionDataTask` with the specified request. + + @param request The HTTP request for the request. + @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any. + */ +- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request + completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler; + +/** + Creates an `NSURLSessionDataTask` with the specified request. + + @param request The HTTP request for the request. + @param uploadProgress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. + @param downloadProgress A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue. + @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any. + */ +- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request + uploadProgress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgressBlock + downloadProgress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgressBlock + completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler; + +///--------------------------- +/// @name Running Upload Tasks +///--------------------------- + +/** + Creates an `NSURLSessionUploadTask` with the specified request for a local file. + + @param request The HTTP request for the request. + @param fileURL A URL to the local file to be uploaded. + @param progress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. + @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any. + + @see `attemptsToRecreateUploadTasksForBackgroundSessions` + */ +- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request + fromFile:(NSURL *)fileURL + progress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgressBlock + completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler; + +/** + Creates an `NSURLSessionUploadTask` with the specified request for an HTTP body. + + @param request The HTTP request for the request. + @param bodyData A data object containing the HTTP body to be uploaded. + @param progress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. + @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any. + */ +- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request + fromData:(nullable NSData *)bodyData + progress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgressBlock + completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler; + +/** + Creates an `NSURLSessionUploadTask` with the specified streaming request. + + @param request The HTTP request for the request. + @param progress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. + @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any. + */ +- (NSURLSessionUploadTask *)uploadTaskWithStreamedRequest:(NSURLRequest *)request + progress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgressBlock + completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler; + +///----------------------------- +/// @name Running Download Tasks +///----------------------------- + +/** + Creates an `NSURLSessionDownloadTask` with the specified request. + + @param request The HTTP request for the request. + @param progress A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue. + @param destination A block object to be executed in order to determine the destination of the downloaded file. This block takes two arguments, the target path & the server response, and returns the desired file URL of the resulting download. The temporary file used during the download will be automatically deleted after being moved to the returned URL. + @param completionHandler A block to be executed when a task finishes. This block has no return value and takes three arguments: the server response, the path of the downloaded file, and the error describing the network or parsing error that occurred, if any. + + @warning If using a background `NSURLSessionConfiguration` on iOS, these blocks will be lost when the app is terminated. Background sessions may prefer to use `-setDownloadTaskDidFinishDownloadingBlock:` to specify the URL for saving the downloaded file, rather than the destination block of this method. + */ +- (NSURLSessionDownloadTask *)downloadTaskWithRequest:(NSURLRequest *)request + progress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgressBlock + destination:(nullable NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination + completionHandler:(nullable void (^)(NSURLResponse *response, NSURL * _Nullable filePath, NSError * _Nullable error))completionHandler; + +/** + Creates an `NSURLSessionDownloadTask` with the specified resume data. + + @param resumeData The data used to resume downloading. + @param progress A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue. + @param destination A block object to be executed in order to determine the destination of the downloaded file. This block takes two arguments, the target path & the server response, and returns the desired file URL of the resulting download. The temporary file used during the download will be automatically deleted after being moved to the returned URL. + @param completionHandler A block to be executed when a task finishes. This block has no return value and takes three arguments: the server response, the path of the downloaded file, and the error describing the network or parsing error that occurred, if any. + */ +- (NSURLSessionDownloadTask *)downloadTaskWithResumeData:(NSData *)resumeData + progress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgressBlock + destination:(nullable NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination + completionHandler:(nullable void (^)(NSURLResponse *response, NSURL * _Nullable filePath, NSError * _Nullable error))completionHandler; + +///--------------------------------- +/// @name Getting Progress for Tasks +///--------------------------------- + +/** + Returns the upload progress of the specified task. + + @param task The session task. Must not be `nil`. + + @return An `NSProgress` object reporting the upload progress of a task, or `nil` if the progress is unavailable. + */ +- (nullable NSProgress *)uploadProgressForTask:(NSURLSessionTask *)task; + +/** + Returns the download progress of the specified task. + + @param task The session task. Must not be `nil`. + + @return An `NSProgress` object reporting the download progress of a task, or `nil` if the progress is unavailable. + */ +- (nullable NSProgress *)downloadProgressForTask:(NSURLSessionTask *)task; + +///----------------------------------------- +/// @name Setting Session Delegate Callbacks +///----------------------------------------- + +/** + Sets a block to be executed when the managed session becomes invalid, as handled by the `NSURLSessionDelegate` method `URLSession:didBecomeInvalidWithError:`. + + @param block A block object to be executed when the managed session becomes invalid. The block has no return value, and takes two arguments: the session, and the error related to the cause of invalidation. + */ +- (void)setSessionDidBecomeInvalidBlock:(nullable void (^)(NSURLSession *session, NSError *error))block; + +/** + Sets a block to be executed when a connection level authentication challenge has occurred, as handled by the `NSURLSessionDelegate` method `URLSession:didReceiveChallenge:completionHandler:`. + + @param block A block object to be executed when a connection level authentication challenge has occurred. The block returns the disposition of the authentication challenge, and takes three arguments: the session, the authentication challenge, and a pointer to the credential that should be used to resolve the challenge. + */ +- (void)setSessionDidReceiveAuthenticationChallengeBlock:(nullable NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential * _Nullable __autoreleasing * _Nullable credential))block; + +///-------------------------------------- +/// @name Setting Task Delegate Callbacks +///-------------------------------------- + +/** + Sets a block to be executed when a task requires a new request body stream to send to the remote server, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:needNewBodyStream:`. + + @param block A block object to be executed when a task requires a new request body stream. + */ +- (void)setTaskNeedNewBodyStreamBlock:(nullable NSInputStream * (^)(NSURLSession *session, NSURLSessionTask *task))block; + +/** + Sets a block to be executed when an HTTP request is attempting to perform a redirection to a different URL, as handled by the `NSURLSessionTaskDelegate` method `URLSession:willPerformHTTPRedirection:newRequest:completionHandler:`. + + @param block A block object to be executed when an HTTP request is attempting to perform a redirection to a different URL. The block returns the request to be made for the redirection, and takes four arguments: the session, the task, the redirection response, and the request corresponding to the redirection response. + */ +- (void)setTaskWillPerformHTTPRedirectionBlock:(nullable NSURLRequest * (^)(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request))block; + +/** + Sets a block to be executed when a session task has received a request specific authentication challenge, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didReceiveChallenge:completionHandler:`. + + @param block A block object to be executed when a session task has received a request specific authentication challenge. The block returns the disposition of the authentication challenge, and takes four arguments: the session, the task, the authentication challenge, and a pointer to the credential that should be used to resolve the challenge. + */ +- (void)setTaskDidReceiveAuthenticationChallengeBlock:(nullable NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, NSURLCredential * _Nullable __autoreleasing * _Nullable credential))block; + +/** + Sets a block to be executed periodically to track upload progress, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:`. + + @param block A block object to be called when an undetermined number of bytes have been uploaded to the server. This block has no return value and takes five arguments: the session, the task, the number of bytes written since the last time the upload progress block was called, the total bytes written, and the total bytes expected to be written during the request, as initially determined by the length of the HTTP body. This block may be called multiple times, and will execute on the main thread. + */ +- (void)setTaskDidSendBodyDataBlock:(nullable void (^)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend))block; + +/** + Sets a block to be executed as the last message related to a specific task, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didCompleteWithError:`. + + @param block A block object to be executed when a session task is completed. The block has no return value, and takes three arguments: the session, the task, and any error that occurred in the process of executing the task. + */ +- (void)setTaskDidCompleteBlock:(nullable void (^)(NSURLSession *session, NSURLSessionTask *task, NSError * _Nullable error))block; + +///------------------------------------------- +/// @name Setting Data Task Delegate Callbacks +///------------------------------------------- + +/** + Sets a block to be executed when a data task has received a response, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:didReceiveResponse:completionHandler:`. + + @param block A block object to be executed when a data task has received a response. The block returns the disposition of the session response, and takes three arguments: the session, the data task, and the received response. + */ +- (void)setDataTaskDidReceiveResponseBlock:(nullable NSURLSessionResponseDisposition (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLResponse *response))block; + +/** + Sets a block to be executed when a data task has become a download task, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:didBecomeDownloadTask:`. + + @param block A block object to be executed when a data task has become a download task. The block has no return value, and takes three arguments: the session, the data task, and the download task it has become. + */ +- (void)setDataTaskDidBecomeDownloadTaskBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLSessionDownloadTask *downloadTask))block; + +/** + Sets a block to be executed when a data task receives data, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:didReceiveData:`. + + @param block A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes three arguments: the session, the data task, and the data received. This block may be called multiple times, and will execute on the session manager operation queue. + */ +- (void)setDataTaskDidReceiveDataBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSData *data))block; + +/** + Sets a block to be executed to determine the caching behavior of a data task, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:willCacheResponse:completionHandler:`. + + @param block A block object to be executed to determine the caching behavior of a data task. The block returns the response to cache, and takes three arguments: the session, the data task, and the proposed cached URL response. + */ +- (void)setDataTaskWillCacheResponseBlock:(nullable NSCachedURLResponse * (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSCachedURLResponse *proposedResponse))block; + +/** + Sets a block to be executed once all messages enqueued for a session have been delivered, as handled by the `NSURLSessionDataDelegate` method `URLSessionDidFinishEventsForBackgroundURLSession:`. + + @param block A block object to be executed once all messages enqueued for a session have been delivered. The block has no return value and takes a single argument: the session. + */ +- (void)setDidFinishEventsForBackgroundURLSessionBlock:(nullable void (^)(NSURLSession *session))block; + +///----------------------------------------------- +/// @name Setting Download Task Delegate Callbacks +///----------------------------------------------- + +/** + Sets a block to be executed when a download task has completed a download, as handled by the `NSURLSessionDownloadDelegate` method `URLSession:downloadTask:didFinishDownloadingToURL:`. + + @param block A block object to be executed when a download task has completed. The block returns the URL the download should be moved to, and takes three arguments: the session, the download task, and the temporary location of the downloaded file. If the file manager encounters an error while attempting to move the temporary file to the destination, an `AFURLSessionDownloadTaskDidFailToMoveFileNotification` will be posted, with the download task as its object, and the user info of the error. + */ +- (void)setDownloadTaskDidFinishDownloadingBlock:(nullable NSURL * _Nullable (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location))block; + +/** + Sets a block to be executed periodically to track download progress, as handled by the `NSURLSessionDownloadDelegate` method `URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesWritten:totalBytesExpectedToWrite:`. + + @param block A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes five arguments: the session, the download task, the number of bytes read since the last time the download progress block was called, the total bytes read, and the total bytes expected to be read during the request, as initially determined by the expected content size of the `NSHTTPURLResponse` object. This block may be called multiple times, and will execute on the session manager operation queue. + */ +- (void)setDownloadTaskDidWriteDataBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite))block; + +/** + Sets a block to be executed when a download task has been resumed, as handled by the `NSURLSessionDownloadDelegate` method `URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:`. + + @param block A block object to be executed when a download task has been resumed. The block has no return value and takes four arguments: the session, the download task, the file offset of the resumed download, and the total number of bytes expected to be downloaded. + */ +- (void)setDownloadTaskDidResumeBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t fileOffset, int64_t expectedTotalBytes))block; + +@end + +///-------------------- +/// @name Notifications +///-------------------- + +/** + Posted when a task resumes. + */ +FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidResumeNotification; + +/** + Posted when a task finishes executing. Includes a userInfo dictionary with additional information about the task. + */ +FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteNotification; + +/** + Posted when a task suspends its execution. + */ +FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidSuspendNotification; + +/** + Posted when a session is invalidated. + */ +FOUNDATION_EXPORT NSString * const AFURLSessionDidInvalidateNotification; + +/** + Posted when a session download task encountered an error when moving the temporary download file to a specified destination. + */ +FOUNDATION_EXPORT NSString * const AFURLSessionDownloadTaskDidFailToMoveFileNotification; + +/** + The raw response data of the task. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if response data exists for the task. + */ +FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteResponseDataKey; + +/** + The serialized response object of the task. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if the response was serialized. + */ +FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteSerializedResponseKey; + +/** + The response serializer used to serialize the response. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if the task has an associated response serializer. + */ +FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteResponseSerializerKey; + +/** + The file path associated with the download task. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if an the response data has been stored directly to disk. + */ +FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteAssetPathKey; + +/** + Any error associated with the task, or the serialization of the response. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if an error exists. + */ +FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteErrorKey; + +NS_ASSUME_NONNULL_END diff --git a/its/plugin/projects/AFNetworking/AFNetworking/AFURLSessionManager.m b/its/plugin/projects/AFNetworking/AFNetworking/AFURLSessionManager.m new file mode 100644 index 00000000..170581ac --- /dev/null +++ b/its/plugin/projects/AFNetworking/AFNetworking/AFURLSessionManager.m @@ -0,0 +1,1244 @@ +// AFURLSessionManager.m +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "AFURLSessionManager.h" +#import + +#ifndef NSFoundationVersionNumber_iOS_8_0 +#define NSFoundationVersionNumber_With_Fixed_5871104061079552_bug 1140.11 +#else +#define NSFoundationVersionNumber_With_Fixed_5871104061079552_bug NSFoundationVersionNumber_iOS_8_0 +#endif + +static dispatch_queue_t url_session_manager_creation_queue() { + static dispatch_queue_t af_url_session_manager_creation_queue; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + af_url_session_manager_creation_queue = dispatch_queue_create("com.alamofire.networking.session.manager.creation", DISPATCH_QUEUE_SERIAL); + }); + + return af_url_session_manager_creation_queue; +} + +static void url_session_manager_create_task_safely(dispatch_block_t block) { + if (NSFoundationVersionNumber < NSFoundationVersionNumber_With_Fixed_5871104061079552_bug) { + // Fix of bug + // Open Radar:http://openradar.appspot.com/radar?id=5871104061079552 (status: Fixed in iOS8) + // Issue about:https://github.com/AFNetworking/AFNetworking/issues/2093 + dispatch_sync(url_session_manager_creation_queue(), block); + } else { + block(); + } +} + +static dispatch_queue_t url_session_manager_processing_queue() { + static dispatch_queue_t af_url_session_manager_processing_queue; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + af_url_session_manager_processing_queue = dispatch_queue_create("com.alamofire.networking.session.manager.processing", DISPATCH_QUEUE_CONCURRENT); + }); + + return af_url_session_manager_processing_queue; +} + +static dispatch_group_t url_session_manager_completion_group() { + static dispatch_group_t af_url_session_manager_completion_group; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + af_url_session_manager_completion_group = dispatch_group_create(); + }); + + return af_url_session_manager_completion_group; +} + +NSString * const AFNetworkingTaskDidResumeNotification = @"com.alamofire.networking.task.resume"; +NSString * const AFNetworkingTaskDidCompleteNotification = @"com.alamofire.networking.task.complete"; +NSString * const AFNetworkingTaskDidSuspendNotification = @"com.alamofire.networking.task.suspend"; +NSString * const AFURLSessionDidInvalidateNotification = @"com.alamofire.networking.session.invalidate"; +NSString * const AFURLSessionDownloadTaskDidFailToMoveFileNotification = @"com.alamofire.networking.session.download.file-manager-error"; + +NSString * const AFNetworkingTaskDidCompleteSerializedResponseKey = @"com.alamofire.networking.task.complete.serializedresponse"; +NSString * const AFNetworkingTaskDidCompleteResponseSerializerKey = @"com.alamofire.networking.task.complete.responseserializer"; +NSString * const AFNetworkingTaskDidCompleteResponseDataKey = @"com.alamofire.networking.complete.finish.responsedata"; +NSString * const AFNetworkingTaskDidCompleteErrorKey = @"com.alamofire.networking.task.complete.error"; +NSString * const AFNetworkingTaskDidCompleteAssetPathKey = @"com.alamofire.networking.task.complete.assetpath"; + +static NSString * const AFURLSessionManagerLockName = @"com.alamofire.networking.session.manager.lock"; + +static NSUInteger const AFMaximumNumberOfAttemptsToRecreateBackgroundSessionUploadTask = 3; + +static void * AFTaskStateChangedContext = &AFTaskStateChangedContext; + +typedef void (^AFURLSessionDidBecomeInvalidBlock)(NSURLSession *session, NSError *error); +typedef NSURLSessionAuthChallengeDisposition (^AFURLSessionDidReceiveAuthenticationChallengeBlock)(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential); + +typedef NSURLRequest * (^AFURLSessionTaskWillPerformHTTPRedirectionBlock)(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request); +typedef NSURLSessionAuthChallengeDisposition (^AFURLSessionTaskDidReceiveAuthenticationChallengeBlock)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential); +typedef void (^AFURLSessionDidFinishEventsForBackgroundURLSessionBlock)(NSURLSession *session); + +typedef NSInputStream * (^AFURLSessionTaskNeedNewBodyStreamBlock)(NSURLSession *session, NSURLSessionTask *task); +typedef void (^AFURLSessionTaskDidSendBodyDataBlock)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend); +typedef void (^AFURLSessionTaskDidCompleteBlock)(NSURLSession *session, NSURLSessionTask *task, NSError *error); + +typedef NSURLSessionResponseDisposition (^AFURLSessionDataTaskDidReceiveResponseBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLResponse *response); +typedef void (^AFURLSessionDataTaskDidBecomeDownloadTaskBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLSessionDownloadTask *downloadTask); +typedef void (^AFURLSessionDataTaskDidReceiveDataBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSData *data); +typedef NSCachedURLResponse * (^AFURLSessionDataTaskWillCacheResponseBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSCachedURLResponse *proposedResponse); + +typedef NSURL * (^AFURLSessionDownloadTaskDidFinishDownloadingBlock)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location); +typedef void (^AFURLSessionDownloadTaskDidWriteDataBlock)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite); +typedef void (^AFURLSessionDownloadTaskDidResumeBlock)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t fileOffset, int64_t expectedTotalBytes); +typedef void (^AFURLSessionTaskProgressBlock)(NSProgress *); + +typedef void (^AFURLSessionTaskCompletionHandler)(NSURLResponse *response, id responseObject, NSError *error); + + +#pragma mark - + +@interface AFURLSessionManagerTaskDelegate : NSObject +@property (nonatomic, weak) AFURLSessionManager *manager; +@property (nonatomic, strong) NSMutableData *mutableData; +@property (nonatomic, strong) NSProgress *uploadProgress; +@property (nonatomic, strong) NSProgress *downloadProgress; +@property (nonatomic, copy) NSURL *downloadFileURL; +@property (nonatomic, copy) AFURLSessionDownloadTaskDidFinishDownloadingBlock downloadTaskDidFinishDownloading; +@property (nonatomic, copy) AFURLSessionTaskProgressBlock uploadProgressBlock; +@property (nonatomic, copy) AFURLSessionTaskProgressBlock downloadProgressBlock; +@property (nonatomic, copy) AFURLSessionTaskCompletionHandler completionHandler; +@end + +@implementation AFURLSessionManagerTaskDelegate + +- (instancetype)init { + self = [super init]; + if (!self) { + return nil; + } + + self.mutableData = [NSMutableData data]; + self.uploadProgress = [[NSProgress alloc] initWithParent:nil userInfo:nil]; + self.uploadProgress.totalUnitCount = NSURLSessionTransferSizeUnknown; + + self.downloadProgress = [[NSProgress alloc] initWithParent:nil userInfo:nil]; + self.downloadProgress.totalUnitCount = NSURLSessionTransferSizeUnknown; + return self; +} + +#pragma mark - NSProgress Tracking + +- (void)setupProgressForTask:(NSURLSessionTask *)task { + __weak __typeof__(task) weakTask = task; + + self.uploadProgress.totalUnitCount = task.countOfBytesExpectedToSend; + self.downloadProgress.totalUnitCount = task.countOfBytesExpectedToReceive; + [self.uploadProgress setCancellable:YES]; + [self.uploadProgress setCancellationHandler:^{ + __typeof__(weakTask) strongTask = weakTask; + [strongTask cancel]; + }]; + [self.uploadProgress setPausable:YES]; + [self.uploadProgress setPausingHandler:^{ + __typeof__(weakTask) strongTask = weakTask; + [strongTask suspend]; + }]; + if ([self.uploadProgress respondsToSelector:@selector(setResumingHandler:)]) { + [self.uploadProgress setResumingHandler:^{ + __typeof__(weakTask) strongTask = weakTask; + [strongTask resume]; + }]; + } + + [self.downloadProgress setCancellable:YES]; + [self.downloadProgress setCancellationHandler:^{ + __typeof__(weakTask) strongTask = weakTask; + [strongTask cancel]; + }]; + [self.downloadProgress setPausable:YES]; + [self.downloadProgress setPausingHandler:^{ + __typeof__(weakTask) strongTask = weakTask; + [strongTask suspend]; + }]; + + if ([self.downloadProgress respondsToSelector:@selector(setResumingHandler:)]) { + [self.downloadProgress setResumingHandler:^{ + __typeof__(weakTask) strongTask = weakTask; + [strongTask resume]; + }]; + } + + [task addObserver:self + forKeyPath:NSStringFromSelector(@selector(countOfBytesReceived)) + options:NSKeyValueObservingOptionNew + context:NULL]; + [task addObserver:self + forKeyPath:NSStringFromSelector(@selector(countOfBytesExpectedToReceive)) + options:NSKeyValueObservingOptionNew + context:NULL]; + + [task addObserver:self + forKeyPath:NSStringFromSelector(@selector(countOfBytesSent)) + options:NSKeyValueObservingOptionNew + context:NULL]; + [task addObserver:self + forKeyPath:NSStringFromSelector(@selector(countOfBytesExpectedToSend)) + options:NSKeyValueObservingOptionNew + context:NULL]; + + [self.downloadProgress addObserver:self + forKeyPath:NSStringFromSelector(@selector(fractionCompleted)) + options:NSKeyValueObservingOptionNew + context:NULL]; + [self.uploadProgress addObserver:self + forKeyPath:NSStringFromSelector(@selector(fractionCompleted)) + options:NSKeyValueObservingOptionNew + context:NULL]; +} + +- (void)cleanUpProgressForTask:(NSURLSessionTask *)task { + [task removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesReceived))]; + [task removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesExpectedToReceive))]; + [task removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesSent))]; + [task removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesExpectedToSend))]; + [self.downloadProgress removeObserver:self forKeyPath:NSStringFromSelector(@selector(fractionCompleted))]; + [self.uploadProgress removeObserver:self forKeyPath:NSStringFromSelector(@selector(fractionCompleted))]; +} + +- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { + if ([object isKindOfClass:[NSURLSessionTask class]] || [object isKindOfClass:[NSURLSessionDownloadTask class]]) { + if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesReceived))]) { + self.downloadProgress.completedUnitCount = [change[@"new"] longLongValue]; + } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesExpectedToReceive))]) { + self.downloadProgress.totalUnitCount = [change[@"new"] longLongValue]; + } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesSent))]) { + self.uploadProgress.completedUnitCount = [change[@"new"] longLongValue]; + } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesExpectedToSend))]) { + self.uploadProgress.totalUnitCount = [change[@"new"] longLongValue]; + } + } + else if ([object isEqual:self.downloadProgress]) { + if (self.downloadProgressBlock) { + self.downloadProgressBlock(object); + } + } + else if ([object isEqual:self.uploadProgress]) { + if (self.uploadProgressBlock) { + self.uploadProgressBlock(object); + } + } +} + +#pragma mark - NSURLSessionTaskDelegate + +- (void)URLSession:(__unused NSURLSession *)session + task:(NSURLSessionTask *)task +didCompleteWithError:(NSError *)error +{ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu" + __strong AFURLSessionManager *manager = self.manager; + + __block id responseObject = nil; + + __block NSMutableDictionary *userInfo = [NSMutableDictionary dictionary]; + userInfo[AFNetworkingTaskDidCompleteResponseSerializerKey] = manager.responseSerializer; + + //Performance Improvement from #2672 + NSData *data = nil; + if (self.mutableData) { + data = [self.mutableData copy]; + //We no longer need the reference, so nil it out to gain back some memory. + self.mutableData = nil; + } + + if (self.downloadFileURL) { + userInfo[AFNetworkingTaskDidCompleteAssetPathKey] = self.downloadFileURL; + } else if (data) { + userInfo[AFNetworkingTaskDidCompleteResponseDataKey] = data; + } + + if (error) { + userInfo[AFNetworkingTaskDidCompleteErrorKey] = error; + + dispatch_group_async(manager.completionGroup ?: url_session_manager_completion_group(), manager.completionQueue ?: dispatch_get_main_queue(), ^{ + if (self.completionHandler) { + self.completionHandler(task.response, responseObject, error); + } + + dispatch_async(dispatch_get_main_queue(), ^{ + [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingTaskDidCompleteNotification object:task userInfo:userInfo]; + }); + }); + } else { + dispatch_async(url_session_manager_processing_queue(), ^{ + NSError *serializationError = nil; + responseObject = [manager.responseSerializer responseObjectForResponse:task.response data:data error:&serializationError]; + + if (self.downloadFileURL) { + responseObject = self.downloadFileURL; + } + + if (responseObject) { + userInfo[AFNetworkingTaskDidCompleteSerializedResponseKey] = responseObject; + } + + if (serializationError) { + userInfo[AFNetworkingTaskDidCompleteErrorKey] = serializationError; + } + + dispatch_group_async(manager.completionGroup ?: url_session_manager_completion_group(), manager.completionQueue ?: dispatch_get_main_queue(), ^{ + if (self.completionHandler) { + self.completionHandler(task.response, responseObject, serializationError); + } + + dispatch_async(dispatch_get_main_queue(), ^{ + [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingTaskDidCompleteNotification object:task userInfo:userInfo]; + }); + }); + }); + } +#pragma clang diagnostic pop +} + +#pragma mark - NSURLSessionDataTaskDelegate + +- (void)URLSession:(__unused NSURLSession *)session + dataTask:(__unused NSURLSessionDataTask *)dataTask + didReceiveData:(NSData *)data +{ + [self.mutableData appendData:data]; +} + +#pragma mark - NSURLSessionDownloadTaskDelegate + +- (void)URLSession:(NSURLSession *)session + downloadTask:(NSURLSessionDownloadTask *)downloadTask +didFinishDownloadingToURL:(NSURL *)location +{ + NSError *fileManagerError = nil; + self.downloadFileURL = nil; + + if (self.downloadTaskDidFinishDownloading) { + self.downloadFileURL = self.downloadTaskDidFinishDownloading(session, downloadTask, location); + if (self.downloadFileURL) { + [[NSFileManager defaultManager] moveItemAtURL:location toURL:self.downloadFileURL error:&fileManagerError]; + + if (fileManagerError) { + [[NSNotificationCenter defaultCenter] postNotificationName:AFURLSessionDownloadTaskDidFailToMoveFileNotification object:downloadTask userInfo:fileManagerError.userInfo]; + } + } + } +} + +@end + +#pragma mark - + +/** + * A workaround for issues related to key-value observing the `state` of an `NSURLSessionTask`. + * + * See: + * - https://github.com/AFNetworking/AFNetworking/issues/1477 + * - https://github.com/AFNetworking/AFNetworking/issues/2638 + * - https://github.com/AFNetworking/AFNetworking/pull/2702 + */ + +static inline void af_swizzleSelector(Class theClass, SEL originalSelector, SEL swizzledSelector) { + Method originalMethod = class_getInstanceMethod(theClass, originalSelector); + Method swizzledMethod = class_getInstanceMethod(theClass, swizzledSelector); + method_exchangeImplementations(originalMethod, swizzledMethod); +} + +static inline BOOL af_addMethod(Class theClass, SEL selector, Method method) { + return class_addMethod(theClass, selector, method_getImplementation(method), method_getTypeEncoding(method)); +} + +static NSString * const AFNSURLSessionTaskDidResumeNotification = @"com.alamofire.networking.nsurlsessiontask.resume"; +static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofire.networking.nsurlsessiontask.suspend"; + +@interface _AFURLSessionTaskSwizzling : NSObject + +@end + +@implementation _AFURLSessionTaskSwizzling + ++ (void)load { + /** + WARNING: Trouble Ahead + https://github.com/AFNetworking/AFNetworking/pull/2702 + */ + + if (NSClassFromString(@"NSURLSessionTask")) { + /** + iOS 7 and iOS 8 differ in NSURLSessionTask implementation, which makes the next bit of code a bit tricky. + Many Unit Tests have been built to validate as much of this behavior has possible. + Here is what we know: + - NSURLSessionTasks are implemented with class clusters, meaning the class you request from the API isn't actually the type of class you will get back. + - Simply referencing `[NSURLSessionTask class]` will not work. You need to ask an `NSURLSession` to actually create an object, and grab the class from there. + - On iOS 7, `localDataTask` is a `__NSCFLocalDataTask`, which inherits from `__NSCFLocalSessionTask`, which inherits from `__NSCFURLSessionTask`. + - On iOS 8, `localDataTask` is a `__NSCFLocalDataTask`, which inherits from `__NSCFLocalSessionTask`, which inherits from `NSURLSessionTask`. + - On iOS 7, `__NSCFLocalSessionTask` and `__NSCFURLSessionTask` are the only two classes that have their own implementations of `resume` and `suspend`, and `__NSCFLocalSessionTask` DOES NOT CALL SUPER. This means both classes need to be swizzled. + - On iOS 8, `NSURLSessionTask` is the only class that implements `resume` and `suspend`. This means this is the only class that needs to be swizzled. + - Because `NSURLSessionTask` is not involved in the class hierarchy for every version of iOS, its easier to add the swizzled methods to a dummy class and manage them there. + + Some Assumptions: + - No implementations of `resume` or `suspend` call super. If this were to change in a future version of iOS, we'd need to handle it. + - No background task classes override `resume` or `suspend` + + The current solution: + 1) Grab an instance of `__NSCFLocalDataTask` by asking an instance of `NSURLSession` for a data task. + 2) Grab a pointer to the original implementation of `af_resume` + 3) Check to see if the current class has an implementation of resume. If so, continue to step 4. + 4) Grab the super class of the current class. + 5) Grab a pointer for the current class to the current implementation of `resume`. + 6) Grab a pointer for the super class to the current implementation of `resume`. + 7) If the current class implementation of `resume` is not equal to the super class implementation of `resume` AND the current implementation of `resume` is not equal to the original implementation of `af_resume`, THEN swizzle the methods + 8) Set the current class to the super class, and repeat steps 3-8 + */ + NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration ephemeralSessionConfiguration]; + NSURLSession * session = [NSURLSession sessionWithConfiguration:configuration]; +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wnonnull" + NSURLSessionDataTask *localDataTask = [session dataTaskWithURL:nil]; +#pragma clang diagnostic pop + IMP originalAFResumeIMP = method_getImplementation(class_getInstanceMethod([self class], @selector(af_resume))); + Class currentClass = [localDataTask class]; + + while (class_getInstanceMethod(currentClass, @selector(resume))) { + Class superClass = [currentClass superclass]; + IMP classResumeIMP = method_getImplementation(class_getInstanceMethod(currentClass, @selector(resume))); + IMP superclassResumeIMP = method_getImplementation(class_getInstanceMethod(superClass, @selector(resume))); + if (classResumeIMP != superclassResumeIMP && + originalAFResumeIMP != classResumeIMP) { + [self swizzleResumeAndSuspendMethodForClass:currentClass]; + } + currentClass = [currentClass superclass]; + } + + [localDataTask cancel]; + [session finishTasksAndInvalidate]; + } +} + ++ (void)swizzleResumeAndSuspendMethodForClass:(Class)theClass { + Method afResumeMethod = class_getInstanceMethod(self, @selector(af_resume)); + Method afSuspendMethod = class_getInstanceMethod(self, @selector(af_suspend)); + + if (af_addMethod(theClass, @selector(af_resume), afResumeMethod)) { + af_swizzleSelector(theClass, @selector(resume), @selector(af_resume)); + } + + if (af_addMethod(theClass, @selector(af_suspend), afSuspendMethod)) { + af_swizzleSelector(theClass, @selector(suspend), @selector(af_suspend)); + } +} + +- (NSURLSessionTaskState)state { + NSAssert(NO, @"State method should never be called in the actual dummy class"); + return NSURLSessionTaskStateCanceling; +} + +- (void)af_resume { + NSAssert([self respondsToSelector:@selector(state)], @"Does not respond to state"); + NSURLSessionTaskState state = [self state]; + [self af_resume]; + + if (state != NSURLSessionTaskStateRunning) { + [[NSNotificationCenter defaultCenter] postNotificationName:AFNSURLSessionTaskDidResumeNotification object:self]; + } +} + +- (void)af_suspend { + NSAssert([self respondsToSelector:@selector(state)], @"Does not respond to state"); + NSURLSessionTaskState state = [self state]; + [self af_suspend]; + + if (state != NSURLSessionTaskStateSuspended) { + [[NSNotificationCenter defaultCenter] postNotificationName:AFNSURLSessionTaskDidSuspendNotification object:self]; + } +} +@end + +#pragma mark - + +@interface AFURLSessionManager () +@property (readwrite, nonatomic, strong) NSURLSessionConfiguration *sessionConfiguration; +@property (readwrite, nonatomic, strong) NSOperationQueue *operationQueue; +@property (readwrite, nonatomic, strong) NSURLSession *session; +@property (readwrite, nonatomic, strong) NSMutableDictionary *mutableTaskDelegatesKeyedByTaskIdentifier; +@property (readonly, nonatomic, copy) NSString *taskDescriptionForSessionTasks; +@property (readwrite, nonatomic, strong) NSLock *lock; +@property (readwrite, nonatomic, copy) AFURLSessionDidBecomeInvalidBlock sessionDidBecomeInvalid; +@property (readwrite, nonatomic, copy) AFURLSessionDidReceiveAuthenticationChallengeBlock sessionDidReceiveAuthenticationChallenge; +@property (readwrite, nonatomic, copy) AFURLSessionDidFinishEventsForBackgroundURLSessionBlock didFinishEventsForBackgroundURLSession; +@property (readwrite, nonatomic, copy) AFURLSessionTaskWillPerformHTTPRedirectionBlock taskWillPerformHTTPRedirection; +@property (readwrite, nonatomic, copy) AFURLSessionTaskDidReceiveAuthenticationChallengeBlock taskDidReceiveAuthenticationChallenge; +@property (readwrite, nonatomic, copy) AFURLSessionTaskNeedNewBodyStreamBlock taskNeedNewBodyStream; +@property (readwrite, nonatomic, copy) AFURLSessionTaskDidSendBodyDataBlock taskDidSendBodyData; +@property (readwrite, nonatomic, copy) AFURLSessionTaskDidCompleteBlock taskDidComplete; +@property (readwrite, nonatomic, copy) AFURLSessionDataTaskDidReceiveResponseBlock dataTaskDidReceiveResponse; +@property (readwrite, nonatomic, copy) AFURLSessionDataTaskDidBecomeDownloadTaskBlock dataTaskDidBecomeDownloadTask; +@property (readwrite, nonatomic, copy) AFURLSessionDataTaskDidReceiveDataBlock dataTaskDidReceiveData; +@property (readwrite, nonatomic, copy) AFURLSessionDataTaskWillCacheResponseBlock dataTaskWillCacheResponse; +@property (readwrite, nonatomic, copy) AFURLSessionDownloadTaskDidFinishDownloadingBlock downloadTaskDidFinishDownloading; +@property (readwrite, nonatomic, copy) AFURLSessionDownloadTaskDidWriteDataBlock downloadTaskDidWriteData; +@property (readwrite, nonatomic, copy) AFURLSessionDownloadTaskDidResumeBlock downloadTaskDidResume; +@end + +@implementation AFURLSessionManager + +- (instancetype)init { + return [self initWithSessionConfiguration:nil]; +} + +- (instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)configuration { + self = [super init]; + if (!self) { + return nil; + } + + if (!configuration) { + configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; + } + + self.sessionConfiguration = configuration; + + self.operationQueue = [[NSOperationQueue alloc] init]; + self.operationQueue.maxConcurrentOperationCount = 1; + + self.session = [NSURLSession sessionWithConfiguration:self.sessionConfiguration delegate:self delegateQueue:self.operationQueue]; + + self.responseSerializer = [AFJSONResponseSerializer serializer]; + + self.securityPolicy = [AFSecurityPolicy defaultPolicy]; + +#if !TARGET_OS_WATCH + self.reachabilityManager = [AFNetworkReachabilityManager sharedManager]; +#endif + + self.mutableTaskDelegatesKeyedByTaskIdentifier = [[NSMutableDictionary alloc] init]; + + self.lock = [[NSLock alloc] init]; + self.lock.name = AFURLSessionManagerLockName; + + [self.session getTasksWithCompletionHandler:^(NSArray *dataTasks, NSArray *uploadTasks, NSArray *downloadTasks) { + for (NSURLSessionDataTask *task in dataTasks) { + [self addDelegateForDataTask:task uploadProgress:nil downloadProgress:nil completionHandler:nil]; + } + + for (NSURLSessionUploadTask *uploadTask in uploadTasks) { + [self addDelegateForUploadTask:uploadTask progress:nil completionHandler:nil]; + } + + for (NSURLSessionDownloadTask *downloadTask in downloadTasks) { + [self addDelegateForDownloadTask:downloadTask progress:nil destination:nil completionHandler:nil]; + } + }]; + + return self; +} + +- (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + +#pragma mark - + +- (NSString *)taskDescriptionForSessionTasks { + return [NSString stringWithFormat:@"%p", self]; +} + +- (void)taskDidResume:(NSNotification *)notification { + NSURLSessionTask *task = notification.object; + if ([task respondsToSelector:@selector(taskDescription)]) { + if ([task.taskDescription isEqualToString:self.taskDescriptionForSessionTasks]) { + dispatch_async(dispatch_get_main_queue(), ^{ + [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingTaskDidResumeNotification object:task]; + }); + } + } +} + +- (void)taskDidSuspend:(NSNotification *)notification { + NSURLSessionTask *task = notification.object; + if ([task respondsToSelector:@selector(taskDescription)]) { + if ([task.taskDescription isEqualToString:self.taskDescriptionForSessionTasks]) { + dispatch_async(dispatch_get_main_queue(), ^{ + [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingTaskDidSuspendNotification object:task]; + }); + } + } +} + +#pragma mark - + +- (AFURLSessionManagerTaskDelegate *)delegateForTask:(NSURLSessionTask *)task { + NSParameterAssert(task); + + AFURLSessionManagerTaskDelegate *delegate = nil; + [self.lock lock]; + delegate = self.mutableTaskDelegatesKeyedByTaskIdentifier[@(task.taskIdentifier)]; + [self.lock unlock]; + + return delegate; +} + +- (void)setDelegate:(AFURLSessionManagerTaskDelegate *)delegate + forTask:(NSURLSessionTask *)task +{ + NSParameterAssert(task); + NSParameterAssert(delegate); + + [self.lock lock]; + self.mutableTaskDelegatesKeyedByTaskIdentifier[@(task.taskIdentifier)] = delegate; + [delegate setupProgressForTask:task]; + [self addNotificationObserverForTask:task]; + [self.lock unlock]; +} + +- (void)addDelegateForDataTask:(NSURLSessionDataTask *)dataTask + uploadProgress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgressBlock + downloadProgress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgressBlock + completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler +{ + AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] init]; + delegate.manager = self; + delegate.completionHandler = completionHandler; + + dataTask.taskDescription = self.taskDescriptionForSessionTasks; + [self setDelegate:delegate forTask:dataTask]; + + delegate.uploadProgressBlock = uploadProgressBlock; + delegate.downloadProgressBlock = downloadProgressBlock; +} + +- (void)addDelegateForUploadTask:(NSURLSessionUploadTask *)uploadTask + progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock + completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler +{ + AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] init]; + delegate.manager = self; + delegate.completionHandler = completionHandler; + + uploadTask.taskDescription = self.taskDescriptionForSessionTasks; + + [self setDelegate:delegate forTask:uploadTask]; + + delegate.uploadProgressBlock = uploadProgressBlock; +} + +- (void)addDelegateForDownloadTask:(NSURLSessionDownloadTask *)downloadTask + progress:(void (^)(NSProgress *downloadProgress)) downloadProgressBlock + destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination + completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler +{ + AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] init]; + delegate.manager = self; + delegate.completionHandler = completionHandler; + + if (destination) { + delegate.downloadTaskDidFinishDownloading = ^NSURL * (NSURLSession * __unused session, NSURLSessionDownloadTask *task, NSURL *location) { + return destination(location, task.response); + }; + } + + downloadTask.taskDescription = self.taskDescriptionForSessionTasks; + + [self setDelegate:delegate forTask:downloadTask]; + + delegate.downloadProgressBlock = downloadProgressBlock; +} + +- (void)removeDelegateForTask:(NSURLSessionTask *)task { + NSParameterAssert(task); + + AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:task]; + [self.lock lock]; + [delegate cleanUpProgressForTask:task]; + [self removeNotificationObserverForTask:task]; + [self.mutableTaskDelegatesKeyedByTaskIdentifier removeObjectForKey:@(task.taskIdentifier)]; + [self.lock unlock]; +} + +#pragma mark - + +- (NSArray *)tasksForKeyPath:(NSString *)keyPath { + __block NSArray *tasks = nil; + dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); + [self.session getTasksWithCompletionHandler:^(NSArray *dataTasks, NSArray *uploadTasks, NSArray *downloadTasks) { + if ([keyPath isEqualToString:NSStringFromSelector(@selector(dataTasks))]) { + tasks = dataTasks; + } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(uploadTasks))]) { + tasks = uploadTasks; + } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(downloadTasks))]) { + tasks = downloadTasks; + } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(tasks))]) { + tasks = [@[dataTasks, uploadTasks, downloadTasks] valueForKeyPath:@"@unionOfArrays.self"]; + } + + dispatch_semaphore_signal(semaphore); + }]; + + dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER); + + return tasks; +} + +- (NSArray *)tasks { + return [self tasksForKeyPath:NSStringFromSelector(_cmd)]; +} + +- (NSArray *)dataTasks { + return [self tasksForKeyPath:NSStringFromSelector(_cmd)]; +} + +- (NSArray *)uploadTasks { + return [self tasksForKeyPath:NSStringFromSelector(_cmd)]; +} + +- (NSArray *)downloadTasks { + return [self tasksForKeyPath:NSStringFromSelector(_cmd)]; +} + +#pragma mark - + +- (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks { + dispatch_async(dispatch_get_main_queue(), ^{ + if (cancelPendingTasks) { + [self.session invalidateAndCancel]; + } else { + [self.session finishTasksAndInvalidate]; + } + }); +} + +#pragma mark - + +- (void)setResponseSerializer:(id )responseSerializer { + NSParameterAssert(responseSerializer); + + _responseSerializer = responseSerializer; +} + +#pragma mark - +- (void)addNotificationObserverForTask:(NSURLSessionTask *)task { + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(taskDidResume:) name:AFNSURLSessionTaskDidResumeNotification object:task]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(taskDidSuspend:) name:AFNSURLSessionTaskDidSuspendNotification object:task]; +} + +- (void)removeNotificationObserverForTask:(NSURLSessionTask *)task { + [[NSNotificationCenter defaultCenter] removeObserver:self name:AFNSURLSessionTaskDidSuspendNotification object:task]; + [[NSNotificationCenter defaultCenter] removeObserver:self name:AFNSURLSessionTaskDidResumeNotification object:task]; +} + +#pragma mark - + +- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request + completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler +{ + return [self dataTaskWithRequest:request uploadProgress:nil downloadProgress:nil completionHandler:completionHandler]; +} + +- (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request + uploadProgress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgressBlock + downloadProgress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgressBlock + completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler { + + __block NSURLSessionDataTask *dataTask = nil; + url_session_manager_create_task_safely(^{ + dataTask = [self.session dataTaskWithRequest:request]; + }); + + [self addDelegateForDataTask:dataTask uploadProgress:uploadProgressBlock downloadProgress:downloadProgressBlock completionHandler:completionHandler]; + + return dataTask; +} + +#pragma mark - + +- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request + fromFile:(NSURL *)fileURL + progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock + completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler +{ + __block NSURLSessionUploadTask *uploadTask = nil; + url_session_manager_create_task_safely(^{ + uploadTask = [self.session uploadTaskWithRequest:request fromFile:fileURL]; + }); + + if (!uploadTask && self.attemptsToRecreateUploadTasksForBackgroundSessions && self.session.configuration.identifier) { + for (NSUInteger attempts = 0; !uploadTask && attempts < AFMaximumNumberOfAttemptsToRecreateBackgroundSessionUploadTask; attempts++) { + uploadTask = [self.session uploadTaskWithRequest:request fromFile:fileURL]; + } + } + + [self addDelegateForUploadTask:uploadTask progress:uploadProgressBlock completionHandler:completionHandler]; + + return uploadTask; +} + +- (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request + fromData:(NSData *)bodyData + progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock + completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler +{ + __block NSURLSessionUploadTask *uploadTask = nil; + url_session_manager_create_task_safely(^{ + uploadTask = [self.session uploadTaskWithRequest:request fromData:bodyData]; + }); + + [self addDelegateForUploadTask:uploadTask progress:uploadProgressBlock completionHandler:completionHandler]; + + return uploadTask; +} + +- (NSURLSessionUploadTask *)uploadTaskWithStreamedRequest:(NSURLRequest *)request + progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock + completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler +{ + __block NSURLSessionUploadTask *uploadTask = nil; + url_session_manager_create_task_safely(^{ + uploadTask = [self.session uploadTaskWithStreamedRequest:request]; + }); + + [self addDelegateForUploadTask:uploadTask progress:uploadProgressBlock completionHandler:completionHandler]; + + return uploadTask; +} + +#pragma mark - + +- (NSURLSessionDownloadTask *)downloadTaskWithRequest:(NSURLRequest *)request + progress:(void (^)(NSProgress *downloadProgress)) downloadProgressBlock + destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination + completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler +{ + __block NSURLSessionDownloadTask *downloadTask = nil; + url_session_manager_create_task_safely(^{ + downloadTask = [self.session downloadTaskWithRequest:request]; + }); + + [self addDelegateForDownloadTask:downloadTask progress:downloadProgressBlock destination:destination completionHandler:completionHandler]; + + return downloadTask; +} + +- (NSURLSessionDownloadTask *)downloadTaskWithResumeData:(NSData *)resumeData + progress:(void (^)(NSProgress *downloadProgress)) downloadProgressBlock + destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination + completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler +{ + __block NSURLSessionDownloadTask *downloadTask = nil; + url_session_manager_create_task_safely(^{ + downloadTask = [self.session downloadTaskWithResumeData:resumeData]; + }); + + [self addDelegateForDownloadTask:downloadTask progress:downloadProgressBlock destination:destination completionHandler:completionHandler]; + + return downloadTask; +} + +#pragma mark - +- (NSProgress *)uploadProgressForTask:(NSURLSessionTask *)task { + return [[self delegateForTask:task] uploadProgress]; +} + +- (NSProgress *)downloadProgressForTask:(NSURLSessionTask *)task { + return [[self delegateForTask:task] downloadProgress]; +} + +#pragma mark - + +- (void)setSessionDidBecomeInvalidBlock:(void (^)(NSURLSession *session, NSError *error))block { + self.sessionDidBecomeInvalid = block; +} + +- (void)setSessionDidReceiveAuthenticationChallengeBlock:(NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential))block { + self.sessionDidReceiveAuthenticationChallenge = block; +} + +- (void)setDidFinishEventsForBackgroundURLSessionBlock:(void (^)(NSURLSession *session))block { + self.didFinishEventsForBackgroundURLSession = block; +} + +#pragma mark - + +- (void)setTaskNeedNewBodyStreamBlock:(NSInputStream * (^)(NSURLSession *session, NSURLSessionTask *task))block { + self.taskNeedNewBodyStream = block; +} + +- (void)setTaskWillPerformHTTPRedirectionBlock:(NSURLRequest * (^)(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request))block { + self.taskWillPerformHTTPRedirection = block; +} + +- (void)setTaskDidReceiveAuthenticationChallengeBlock:(NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential))block { + self.taskDidReceiveAuthenticationChallenge = block; +} + +- (void)setTaskDidSendBodyDataBlock:(void (^)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend))block { + self.taskDidSendBodyData = block; +} + +- (void)setTaskDidCompleteBlock:(void (^)(NSURLSession *session, NSURLSessionTask *task, NSError *error))block { + self.taskDidComplete = block; +} + +#pragma mark - + +- (void)setDataTaskDidReceiveResponseBlock:(NSURLSessionResponseDisposition (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLResponse *response))block { + self.dataTaskDidReceiveResponse = block; +} + +- (void)setDataTaskDidBecomeDownloadTaskBlock:(void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLSessionDownloadTask *downloadTask))block { + self.dataTaskDidBecomeDownloadTask = block; +} + +- (void)setDataTaskDidReceiveDataBlock:(void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSData *data))block { + self.dataTaskDidReceiveData = block; +} + +- (void)setDataTaskWillCacheResponseBlock:(NSCachedURLResponse * (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSCachedURLResponse *proposedResponse))block { + self.dataTaskWillCacheResponse = block; +} + +#pragma mark - + +- (void)setDownloadTaskDidFinishDownloadingBlock:(NSURL * (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location))block { + self.downloadTaskDidFinishDownloading = block; +} + +- (void)setDownloadTaskDidWriteDataBlock:(void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite))block { + self.downloadTaskDidWriteData = block; +} + +- (void)setDownloadTaskDidResumeBlock:(void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t fileOffset, int64_t expectedTotalBytes))block { + self.downloadTaskDidResume = block; +} + +#pragma mark - NSObject + +- (NSString *)description { + return [NSString stringWithFormat:@"<%@: %p, session: %@, operationQueue: %@>", NSStringFromClass([self class]), self, self.session, self.operationQueue]; +} + +- (BOOL)respondsToSelector:(SEL)selector { + if (selector == @selector(URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:)) { + return self.taskWillPerformHTTPRedirection != nil; + } else if (selector == @selector(URLSession:dataTask:didReceiveResponse:completionHandler:)) { + return self.dataTaskDidReceiveResponse != nil; + } else if (selector == @selector(URLSession:dataTask:willCacheResponse:completionHandler:)) { + return self.dataTaskWillCacheResponse != nil; + } else if (selector == @selector(URLSessionDidFinishEventsForBackgroundURLSession:)) { + return self.didFinishEventsForBackgroundURLSession != nil; + } + + return [[self class] instancesRespondToSelector:selector]; +} + +#pragma mark - NSURLSessionDelegate + +- (void)URLSession:(NSURLSession *)session +didBecomeInvalidWithError:(NSError *)error +{ + if (self.sessionDidBecomeInvalid) { + self.sessionDidBecomeInvalid(session, error); + } + + [[NSNotificationCenter defaultCenter] postNotificationName:AFURLSessionDidInvalidateNotification object:session]; +} + +- (void)URLSession:(NSURLSession *)session +didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge + completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler +{ + NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling; + __block NSURLCredential *credential = nil; + + if (self.sessionDidReceiveAuthenticationChallenge) { + disposition = self.sessionDidReceiveAuthenticationChallenge(session, challenge, &credential); + } else { + if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { + if ([self.securityPolicy evaluateServerTrust:challenge.protectionSpace.serverTrust forDomain:challenge.protectionSpace.host]) { + credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]; + if (credential) { + disposition = NSURLSessionAuthChallengeUseCredential; + } else { + disposition = NSURLSessionAuthChallengePerformDefaultHandling; + } + } else { + disposition = NSURLSessionAuthChallengeRejectProtectionSpace; + } + } else { + disposition = NSURLSessionAuthChallengePerformDefaultHandling; + } + } + + if (completionHandler) { + completionHandler(disposition, credential); + } +} + +#pragma mark - NSURLSessionTaskDelegate + +- (void)URLSession:(NSURLSession *)session + task:(NSURLSessionTask *)task +willPerformHTTPRedirection:(NSHTTPURLResponse *)response + newRequest:(NSURLRequest *)request + completionHandler:(void (^)(NSURLRequest *))completionHandler +{ + NSURLRequest *redirectRequest = request; + + if (self.taskWillPerformHTTPRedirection) { + redirectRequest = self.taskWillPerformHTTPRedirection(session, task, response, request); + } + + if (completionHandler) { + completionHandler(redirectRequest); + } +} + +- (void)URLSession:(NSURLSession *)session + task:(NSURLSessionTask *)task +didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge + completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler +{ + NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling; + __block NSURLCredential *credential = nil; + + if (self.taskDidReceiveAuthenticationChallenge) { + disposition = self.taskDidReceiveAuthenticationChallenge(session, task, challenge, &credential); + } else { + if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { + if ([self.securityPolicy evaluateServerTrust:challenge.protectionSpace.serverTrust forDomain:challenge.protectionSpace.host]) { + disposition = NSURLSessionAuthChallengeUseCredential; + credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]; + } else { + disposition = NSURLSessionAuthChallengeRejectProtectionSpace; + } + } else { + disposition = NSURLSessionAuthChallengePerformDefaultHandling; + } + } + + if (completionHandler) { + completionHandler(disposition, credential); + } +} + +- (void)URLSession:(NSURLSession *)session + task:(NSURLSessionTask *)task + needNewBodyStream:(void (^)(NSInputStream *bodyStream))completionHandler +{ + NSInputStream *inputStream = nil; + + if (self.taskNeedNewBodyStream) { + inputStream = self.taskNeedNewBodyStream(session, task); + } else if (task.originalRequest.HTTPBodyStream && [task.originalRequest.HTTPBodyStream conformsToProtocol:@protocol(NSCopying)]) { + inputStream = [task.originalRequest.HTTPBodyStream copy]; + } + + if (completionHandler) { + completionHandler(inputStream); + } +} + +- (void)URLSession:(NSURLSession *)session + task:(NSURLSessionTask *)task + didSendBodyData:(int64_t)bytesSent + totalBytesSent:(int64_t)totalBytesSent +totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend +{ + + int64_t totalUnitCount = totalBytesExpectedToSend; + if(totalUnitCount == NSURLSessionTransferSizeUnknown) { + NSString *contentLength = [task.originalRequest valueForHTTPHeaderField:@"Content-Length"]; + if(contentLength) { + totalUnitCount = (int64_t) [contentLength longLongValue]; + } + } + + if (self.taskDidSendBodyData) { + self.taskDidSendBodyData(session, task, bytesSent, totalBytesSent, totalUnitCount); + } +} + +- (void)URLSession:(NSURLSession *)session + task:(NSURLSessionTask *)task +didCompleteWithError:(NSError *)error +{ + AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:task]; + + // delegate may be nil when completing a task in the background + if (delegate) { + [delegate URLSession:session task:task didCompleteWithError:error]; + + [self removeDelegateForTask:task]; + } + + if (self.taskDidComplete) { + self.taskDidComplete(session, task, error); + } +} + +#pragma mark - NSURLSessionDataDelegate + +- (void)URLSession:(NSURLSession *)session + dataTask:(NSURLSessionDataTask *)dataTask +didReceiveResponse:(NSURLResponse *)response + completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler +{ + NSURLSessionResponseDisposition disposition = NSURLSessionResponseAllow; + + if (self.dataTaskDidReceiveResponse) { + disposition = self.dataTaskDidReceiveResponse(session, dataTask, response); + } + + if (completionHandler) { + completionHandler(disposition); + } +} + +- (void)URLSession:(NSURLSession *)session + dataTask:(NSURLSessionDataTask *)dataTask +didBecomeDownloadTask:(NSURLSessionDownloadTask *)downloadTask +{ + AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:dataTask]; + if (delegate) { + [self removeDelegateForTask:dataTask]; + [self setDelegate:delegate forTask:downloadTask]; + } + + if (self.dataTaskDidBecomeDownloadTask) { + self.dataTaskDidBecomeDownloadTask(session, dataTask, downloadTask); + } +} + +- (void)URLSession:(NSURLSession *)session + dataTask:(NSURLSessionDataTask *)dataTask + didReceiveData:(NSData *)data +{ + + AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:dataTask]; + [delegate URLSession:session dataTask:dataTask didReceiveData:data]; + + if (self.dataTaskDidReceiveData) { + self.dataTaskDidReceiveData(session, dataTask, data); + } +} + +- (void)URLSession:(NSURLSession *)session + dataTask:(NSURLSessionDataTask *)dataTask + willCacheResponse:(NSCachedURLResponse *)proposedResponse + completionHandler:(void (^)(NSCachedURLResponse *cachedResponse))completionHandler +{ + NSCachedURLResponse *cachedResponse = proposedResponse; + + if (self.dataTaskWillCacheResponse) { + cachedResponse = self.dataTaskWillCacheResponse(session, dataTask, proposedResponse); + } + + if (completionHandler) { + completionHandler(cachedResponse); + } +} + +- (void)URLSessionDidFinishEventsForBackgroundURLSession:(NSURLSession *)session { + if (self.didFinishEventsForBackgroundURLSession) { + dispatch_async(dispatch_get_main_queue(), ^{ + self.didFinishEventsForBackgroundURLSession(session); + }); + } +} + +#pragma mark - NSURLSessionDownloadDelegate + +- (void)URLSession:(NSURLSession *)session + downloadTask:(NSURLSessionDownloadTask *)downloadTask +didFinishDownloadingToURL:(NSURL *)location +{ + AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:downloadTask]; + if (self.downloadTaskDidFinishDownloading) { + NSURL *fileURL = self.downloadTaskDidFinishDownloading(session, downloadTask, location); + if (fileURL) { + delegate.downloadFileURL = fileURL; + NSError *error = nil; + [[NSFileManager defaultManager] moveItemAtURL:location toURL:fileURL error:&error]; + if (error) { + [[NSNotificationCenter defaultCenter] postNotificationName:AFURLSessionDownloadTaskDidFailToMoveFileNotification object:downloadTask userInfo:error.userInfo]; + } + + return; + } + } + + if (delegate) { + [delegate URLSession:session downloadTask:downloadTask didFinishDownloadingToURL:location]; + } +} + +- (void)URLSession:(NSURLSession *)session + downloadTask:(NSURLSessionDownloadTask *)downloadTask + didWriteData:(int64_t)bytesWritten + totalBytesWritten:(int64_t)totalBytesWritten +totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite +{ + if (self.downloadTaskDidWriteData) { + self.downloadTaskDidWriteData(session, downloadTask, bytesWritten, totalBytesWritten, totalBytesExpectedToWrite); + } +} + +- (void)URLSession:(NSURLSession *)session + downloadTask:(NSURLSessionDownloadTask *)downloadTask + didResumeAtOffset:(int64_t)fileOffset +expectedTotalBytes:(int64_t)expectedTotalBytes +{ + if (self.downloadTaskDidResume) { + self.downloadTaskDidResume(session, downloadTask, fileOffset, expectedTotalBytes); + } +} + +#pragma mark - NSSecureCoding + ++ (BOOL)supportsSecureCoding { + return YES; +} + +- (instancetype)initWithCoder:(NSCoder *)decoder { + NSURLSessionConfiguration *configuration = [decoder decodeObjectOfClass:[NSURLSessionConfiguration class] forKey:@"sessionConfiguration"]; + + self = [self initWithSessionConfiguration:configuration]; + if (!self) { + return nil; + } + + return self; +} + +- (void)encodeWithCoder:(NSCoder *)coder { + [coder encodeObject:self.session.configuration forKey:@"sessionConfiguration"]; +} + +#pragma mark - NSCopying + +- (instancetype)copyWithZone:(NSZone *)zone { + return [[[self class] allocWithZone:zone] initWithSessionConfiguration:self.session.configuration]; +} + +@end diff --git a/its/plugin/projects/AFNetworking/CHANGELOG.md b/its/plugin/projects/AFNetworking/CHANGELOG.md new file mode 100644 index 00000000..82dc3d02 --- /dev/null +++ b/its/plugin/projects/AFNetworking/CHANGELOG.md @@ -0,0 +1,1996 @@ +#Change Log +All notable changes to this project will be documented in this file. +`AFNetworking` adheres to [Semantic Versioning](http://semver.org/). + +--- + +## [3.0.4](https://github.com/AFNetworking/AFNetworking/releases/tag/3.0.4) (12/18/2015) +Released on Friday, December 18, 2015. All issues associated with this milestone can be found using this [filter](https://github.com/AFNetworking/AFNetworking/issues?q=milestone%3A3.0.4+is%3Aclosed). + +#### Fixed +* Fixed issue where `AFNSURLSessionTaskDidResumeNotification` was removed twice + * Implemented by Kevin Harwood in [#3236](https://github.com/AFNetworking/AFNetworking/pull/3236). + + +## [3.0.3](https://github.com/AFNetworking/AFNetworking/releases/tag/3.0.3) (12/16/2015) +Released on Wednesday, December 16, 2015. All issues associated with this milestone can be found using this [filter](https://github.com/AFNetworking/AFNetworking/issues?q=milestone%3A3.0.3+is%3Aclosed). + +#### Added +* Added tests for response serializers to increase test coverage + * Implemented by Kevin Harwood in [#3233](https://github.com/AFNetworking/AFNetworking/pull/3233). + +#### Fixed +* Fixed `AFImageResponseSerializer` serialization macros on watchOS and tvOS + * Implemented by Charles Joseph in [#3229](https://github.com/AFNetworking/AFNetworking/pull/3229). + + +## [3.0.2](https://github.com/AFNetworking/AFNetworking/releases/tag/3.0.2) (12/14/2015) +Released on Monday, December 14, 2015. All issues associated with this milestone can be found using this [filter](https://github.com/AFNetworking/AFNetworking/issues?q=milestone%3A3.0.2+is%3Aclosed). + +#### Fixed +* Fixed a crash in `AFURLSessionManager` when resuming download tasks + * Implemented by Chongyu Zhu in [#3222](https://github.com/AFNetworking/AFNetworking/pull/3222). +* Fixed issue where background button image would not be updated + * Implemented by eofs in [#3220](https://github.com/AFNetworking/AFNetworking/pull/3220). + + +## [3.0.1](https://github.com/AFNetworking/AFNetworking/releases/tag/3.0.1) (12/11/2015) +Released on Friday, December 11, 2015. All issues associated with this milestone can be found using this [filter](https://github.com/AFNetworking/AFNetworking/issues?q=milestone%3A3.0.1+is%3Aclosed). + +#### Added +* Added Xcode 7.2 support to Travis + * Implemented by Kevin Harwood in [#3216](https://github.com/AFNetworking/AFNetworking/pull/3216). + +#### Fixed +* Fixed race condition with ImageView/Button image downloading when starting/cancelling/starting the same request + * Implemented by Kevin Harwood in [#3215](https://github.com/AFNetworking/AFNetworking/pull/3215). + + +## [3.0.0](https://github.com/AFNetworking/AFNetworking/releases/tag/3.0.0) (12/10/2015) +Released on Thursday, December 10, 2015. All issues associated with this milestone can be found using this [filter](https://github.com/AFNetworking/AFNetworking/issues?q=milestone%3A3.0.0+is%3Aclosed). + +For detailed information about migrating to AFNetworking 3.0.0, please reference the [migration guide](https://github.com/AFNetworking/AFNetworking/wiki/AFNetworking-3.0-Migration-Guide). All 3.0.0 beta changes will be tracked with this [filter](https://github.com/AFNetworking/AFNetworking/issues?q=milestone%3A3.0.0+is%3Aclosed). + +#### Added +* Added support for older versions of Xcode to Travis + * Implemented by Kevin Harwood in [#3209](https://github.com/AFNetworking/AFNetworking/pull/3209). +* Added support for [Codecov.io](https://codecov.io/github/AFNetworking/AFNetworking/AFNetworking?branch=master#sort=coverage&dir=desc) + * Implemented by Cédric Luthi and Kevin Harwood in [#3196](https://github.com/AFNetworking/AFNetworking/pull/3196). + * * **Please help us increase overall coverage by submitting a pull request!** +* Added support for IPv6 to Reachability + * Implemented by SAMUKEI and Kevin Harwood in [#3174](https://github.com/AFNetworking/AFNetworking/pull/3174). +* Added support for Objective-C light weight generics + * Implemented by Kevin Harwood in [#3166](https://github.com/AFNetworking/AFNetworking/pull/3166). +* Added nullability attributes to response object in success block + * Implemented by Nathan Racklyeft in [#3154](https://github.com/AFNetworking/AFNetworking/pull/3154). +* Migrated to Fastlane for CI and Deployment + * Implemented by Kevin Harwood in [#3148](https://github.com/AFNetworking/AFNetworking/pull/3148). +* Added support for tvOS + * Implemented by Kevin Harwood in [#3128](https://github.com/AFNetworking/AFNetworking/issues/3128). +* New image downloading architecture + * Implemented by Kevin Harwood in [#3122](https://github.com/AFNetworking/AFNetworking/issues/3122). +* Added Carthage Support + * Implemented by Kevin Harwood in [#3121](https://github.com/AFNetworking/AFNetworking/issues/3121). +* Added a method to create a unique reachability manager + * Implemented by Mo Bitar in [#3111](https://github.com/AFNetworking/AFNetworking/pull/3111). +* Added a initial delay to the network indicator per the Apple HIG + * Implemented by Kevin Harwood in [#3094](https://github.com/AFNetworking/AFNetworking/pull/3094). + +#### Updated +* Improved testing reliability for continuous integration + * Implemented by Kevin Harwood in [#3124](https://github.com/AFNetworking/AFNetworking/pull/3124). +* Example project now consumes AFNetworking as a library. + * Implemented by Kevin Harwood in [#3068](https://github.com/AFNetworking/AFNetworking/pull/3068). +* Migrated to using `instancetype` where applicable + * Implemented by Kyle Fuller in [#3064](https://github.com/AFNetworking/AFNetworking/pull/3064). +* Tweaks to project to support Framework Project + * Implemented by Christian Noon in [#3062](https://github.com/AFNetworking/AFNetworking/pull/3062). + +#### Changed +* Split the iOS and OS X AppDelegate classes in the Example Project + * Implemented by Cédric Luthi in [#3193](https://github.com/AFNetworking/AFNetworking/pull/3193). +* Changed SSL Pinning Error to be `NSURLErrorServerCertificateUntrusted` + * Implemented by Cédric Luthi and Kevin Harwood in [#3191](https://github.com/AFNetworking/AFNetworking/pull/3191). +* New Progress Reporting API using `NSProgress` + * Implemented by Kevin Harwood in [#3187](https://github.com/AFNetworking/AFNetworking/pull/3187). +* Changed `pinnedCertificates` type in `AFSecurityPolicy` from `NSArray` to `NSSet` + * Implemented by Cédric Luthi in [#3164](https://github.com/AFNetworking/AFNetworking/pull/3164). + +#### Fixed +* Improved task creation performance for iOS 8+ + * Implemented by nikitahils, Nikita G and Kevin Harwood in [#3208](https://github.com/AFNetworking/AFNetworking/pull/3208). +* Fixed certificate validation for servers providing incomplete chains + * Implemented by André Pacheco Neves in [#3159](https://github.com/AFNetworking/AFNetworking/pull/3159). +* Fixed bug in `AFMultipartBodyStream` that may cause the input stream to read more bytes than required. + * Implemented by bang in [#3153](https://github.com/AFNetworking/AFNetworking/pull/3153). +* Fixed race condition crash from Resume/Suspend task notifications + * Implemented by Kevin Harwood in [#3152](https://github.com/AFNetworking/AFNetworking/pull/3152). +* Fixed `AFImageDownloader` stalling after numerous failures + * Implemented by Rick Silva in [#3150](https://github.com/AFNetworking/AFNetworking/pull/3150). +* Fixed warnings generated in UIWebView category + * Implemented by Kevin Harwood in [#3126](https://github.com/AFNetworking/AFNetworking/pull/3126). + +#### Removed +* Removed AFBase64EncodedStringFromString static function + * Implemented by Cédric Luthi in [#3188](https://github.com/AFNetworking/AFNetworking/pull/3188). +* Removed code supporting conditional compilation for unsupported development configurations. + * Implemented by Cédric Luthi in [#3177](https://github.com/AFNetworking/AFNetworking/pull/3177). +* Removed deprecated methods, properties, and notifications from AFN 2.x + * Implemented by Kevin Harwood in [#3168](https://github.com/AFNetworking/AFNetworking/pull/3168). +* Removed support for `NSURLConnection` + * Implemented by Kevin Harwood in [#3120](https://github.com/AFNetworking/AFNetworking/issues/3120). +* Removed `UIAlertView` category support since it is now deprecated + * Implemented by Kevin Harwood in [#3034](https://github.com/AFNetworking/AFNetworking/pull/3034). + + +##[2.6.3](https://github.com/AFNetworking/AFNetworking/releases/tag/2.6.3) (11/11/2015) +Released on Wednesday, November 11, 2015. All issues associated with this milestone can be found using this [filter](https://github.com/AFNetworking/AFNetworking/issues?q=milestone%3A2.6.3+is%3Aclosed). + +#### Fixed +* Fixed clang analyzer warning suppression that prevented building under some project configurations + * Fixed by [Kevin Harwood](https://github.com/Kevin Harwood) in [#3142](https://github.com/AFNetworking/AFNetworking/pull/3142). +* Restored Xcode 6 compatibility + * Fixed by [jcayzac](https://github.com/jcayzac) in [#3139](https://github.com/AFNetworking/AFNetworking/pull/3139). + + +##[2.6.2](https://github.com/AFNetworking/AFNetworking/releases/tag/2.6.2) (11/06/2015) +Released on Friday, November 06, 2015. All issues associated with this milestone can be found using this [filter](https://github.com/AFNetworking/AFNetworking/issues?q=milestone%3A2.6.2+is%3Aclosed). + +### Important Upgrade Note for Swift +* [#3130](https://github.com/AFNetworking/AFNetworking/pull/3130) fixes a swift interop error that does have a breaking API change if you are using Swift. This was [identified](https://github.com/AFNetworking/AFNetworking/issues/3137) after 2.6.2 was released. It changes the method from `throws` to an error pointer, since that method does return an object and also handles an error pointer, which does not play nicely with the Swift/Objective-C error conversion. See [#2810](https://github.com/AFNetworking/AFNetworking/issues/2810) for additional notes. This affects `AFURLRequestionSerializer` and `AFURLResponseSerializer`. + +#### Added +* `AFHTTPSessionManager` now copies its `securityPolicy` + * Fixed by [mohamede1945](https://github.com/mohamede1945) in [#2887](https://github.com/AFNetworking/AFNetworking/pull/2887). + +#### Updated +* Updated travis to run on 7.1 + * Fixed by [Kevin Harwood](https://github.com/Kevin Harwood) in [#3132](https://github.com/AFNetworking/AFNetworking/pull/3132). +* Simplifications of if and return statements in `AFSecurityPolicy` + * Fixed by [TorreyBetts](https://github.com/TorreyBetts) in [#3063](https://github.com/AFNetworking/AFNetworking/pull/3063). + +#### Fixed +* Fixed swift interop issue that prevented returning a nil NSURL for a download task + * Fixed by [Kevin Harwood](https://github.com/Kevin Harwood) in [#3133](https://github.com/AFNetworking/AFNetworking/pull/3133). +* Suppressed false positive memory leak warning in Reachability Manager + * Fixed by [Kevin Harwood](https://github.com/Kevin Harwood) in [#3131](https://github.com/AFNetworking/AFNetworking/pull/3131). +* Fixed swift interop issue with throws and Request/Response serialization. + * Fixed by [Kevin Harwood](https://github.com/Kevin Harwood) in [#3130](https://github.com/AFNetworking/AFNetworking/pull/3130). +* Fixed race condition in reachability callback delivery + * Fixed by [MichaelHackett](https://github.com/MichaelHackett) in [#3117](https://github.com/AFNetworking/AFNetworking/pull/3117). +* Fixed URLs that were redirecting in the README + * Fixed by [frankenbot](https://github.com/frankenbot) in [#3109](https://github.com/AFNetworking/AFNetworking/pull/3109). +* Fixed Project Warnings + * Fixed by [Kevin Harwood](https://github.com/Kevin Harwood) in [#3102](https://github.com/AFNetworking/AFNetworking/pull/3102). +* Fixed README link to WWDC session + * Fixed by [wrtsprt](https://github.com/wrtsprt) in [#3099](https://github.com/AFNetworking/AFNetworking/pull/3099). +* Switched from `OS_OBJECT_HAVE_OBJC_SUPPORT` to `OS_OBJECT_USE_OBJC` for watchOS 2 support. + * Fixed by [kylef](https://github.com/kylef) in [#3065](https://github.com/AFNetworking/AFNetworking/pull/3065). +* Added missing __nullable attributes to failure blocks in `AFHTTPRequestOperationManager` and `AFHTTPSessionManager` + * Fixed by [hoppenichu](https://github.com/hoppenichu) in [#3057](https://github.com/AFNetworking/AFNetworking/pull/3057). +* Fixed memory leak in NSURLSession handling + * Fixed by [olegnaumenko](https://github.com/olegnaumenko) in [#2794](https://github.com/AFNetworking/AFNetworking/pull/2794). + + +## [2.6.1](https://github.com/AFNetworking/AFNetworking/releases/tag/2.6.1) (10-13-2015) +Released on Tuesday, October 13th, 2015. All issues associated with this milestone can be found using this [filter](https://github.com/AFNetworking/AFNetworking/issues?q=milestone%3A2.6.1+is%3Aclosed). + +###Future Compatibility Note +Note that AFNetworking 3.0 will soon be released, and will drop support for all `NSURLConnection` based API's (`AFHTTPRequestOperationManager`, `AFHTTPRequestOperation`, and `AFURLConnectionOperation`. If you have not already migrated to `NSURLSession` based API's, please do so soon. For more information, please see the [3.0 migration guide](https://github.com/AFNetworking/AFNetworking/wiki/AFNetworking-3.0-Migration-Guide). + +####Fixed +* Fixed a bug that prevented empty x-www-form-urlencoded bodies. + * Fixed by [Julien Cayzac](https://github.com/jcayzac) in [#2868](https://github.com/AFNetworking/AFNetworking/pull/2868). +* Fixed bug that prevented AFNetworking from being installed for watchOS via Cocoapods. + * Fixed by [Kevin Harwood](https://github.com/Kevin Harwood) in [#2909](https://github.com/AFNetworking/AFNetworking/issues/2909). +* Added missing nullable attributes to `AFURLRequestSerialization` and `AFURLSessionManager`. + * Fixed by [andrewtoth](https://github.com/andrewtoth) in [#2911](https://github.com/AFNetworking/AFNetworking/pull/2911). +* Migrated to `OS_OBJECT_USE_OBJC`. + * Fixed by [canius](https://github.com/canius) in [#2930](https://github.com/AFNetworking/AFNetworking/pull/2930). +* Added missing nullable tags to UIKit extensions. + * Fixed by [Kevin Harwood](https://github.com/Kevin Harwood) in [#3000](https://github.com/AFNetworking/AFNetworking/pull/3000). +* Fixed potential infinite recursion loop if multiple versions of AFNetworking are loaded in a target. + * Fixed by [Kevin Harwood](https://github.com/Kevin Harwood) in [#2743](https://github.com/AFNetworking/AFNetworking/issues/2743). +* Updated Travis CI test script + * Fixed by [Kevin Harwood](https://github.com/Kevin Harwood) in [#3032](https://github.com/AFNetworking/AFNetworking/issues/3032). +* Migrated to `FOUNDATION_EXPORT` from `extern`. + * Fixed by [Andrey Mikhaylov](https://github.com/pronebird) in [#3041](https://github.com/AFNetworking/AFNetworking/pull/3041). +* Fixed issue where `AFURLConnectionOperation` could get stuck in an infinite loop. + * Fixed by [Mattt Thompson](https://github.com/mattt) in [#2496](https://github.com/AFNetworking/AFNetworking/pull/2496). +* Fixed regression where URL request serialization would crash on iOS 8 for long URLs. + * Fixed by [softenhard](https://github.com/softenhard) in [#3028](https://github.com/AFNetworking/AFNetworking/pull/3028). + +## [2.6.0](https://github.com/AFNetworking/AFNetworking/releases/tag/2.6.0) (08-19-2015) +Released on Wednesday, August 19th, 2015. All issues associated with this milestone can be found using this [filter](https://github.com/AFNetworking/AFNetworking/issues?q=milestone%3A2.6.0+is%3Aclosed). + +###Important Upgrade Notes +Please note the following API/project changes have been made: + +* iOS 6 and OS X 10.8 support has been dropped from the project to facilitate support for watchOS 2. The final release supporting iOS 6 and OS X 10.8 is 2.5.4. +* **Full Certificate Chain Validation has been removed** from `AFSecurityPolicy`. As discussed in [#2744](https://github.com/AFNetworking/AFNetworking/issues/2744), there was no documented security advantage to pinning against an entire certificate chain. If you were using full certificate chain, please determine and select the most ideal certificate in your chain to pin against. + * Implemented by [Kevin Harwood](https://github.com/Kevin Harwood) in [#2856](https://github.com/AFNetworking/AFNetworking/pull/2856). +* **The request url will now be returned by the `UIImageView` category if the image is returned from cache.** In previous releases, both the request and the response were nil. Going forward, only the response will be nil. + * Implemented by [Chris Gibbs](https://github.com/chrisgibbs) in [#2771](https://github.com/AFNetworking/AFNetworking/pull/2771). +* **Support for App Extension Targets is now baked in using `NS_EXTENSION_UNAVAILABLE_IOS`.** You no longer need to define `AF_APP_EXTENSIONS` in order to include code in a extension target. + * Implemented by [bnickel](https://github.com/bnickel) in [#2737](https://github.com/AFNetworking/AFNetworking/pull/2737). +* This release now supports watchOS 2.0, which relys on target conditionals that are only present in Xcode 7 and iOS 9/watchOS 2.0/OS X 10.10. If you install the library using CocoaPods, AFNetworking will define these target conditionals for on older platforms, allowing your code to compile. If you do not use Cocoapods, you will need to add the following code your to PCH file. + +``` +#ifndef TARGET_OS_IOS + #define TARGET_OS_IOS TARGET_OS_IPHONE +#endif +#ifndef TARGET_OS_WATCH + #define TARGET_OS_WATCH 0 +#endif +``` +* This release migrates query parameter serialization to model AlamoFire and adhere to RFC standards. Note that `/` and `?` are no longer encoded by default. + * Implemented by [Kevin Harwood](https://github.com/Kevin Harwood) in [#2908](https://github.com/AFNetworking/AFNetworking/pull/2908). + + + +**Note** that support for `NSURLConnection` based API's will be removed in a future update. If you have not already done so, it is recommended that you transition to the `NSURLSession` APIs in the very near future. + +####Added +* Added watchOS 2.0 support. `AFNetworking` can now be added to watchOS targets using CocoaPods. + * Added by [Kevin Harwood](https://github.com/Kevin Harwood) in [#2837](https://github.com/AFNetworking/AFNetworking/issues/2837). +* Added nullability annotations to all of the header files to improve Swift interoperability. + * Added by [Frank LSF](https://github.com/franklsf95) and [Kevin Harwood](https://github.com/Kevin Harwood) in [#2814](https://github.com/AFNetworking/AFNetworking/pull/2814). +* Converted source to Modern Objective-C Syntax. + * Implemented by [Matt Shedlick](https://github.com/mattshedlick) and [Kevin Harwood](https://github.com/Kevin Harwood) in [#2688](https://github.com/AFNetworking/AFNetworking/pull/2688). +* Improved memory performance when download large objects. + * Fixed by [Gabe Zabrino](https://github.com/gfzabarino) and [Kevin Harwood](https://github.com/Kevin Harwood) in [#2672](https://github.com/AFNetworking/AFNetworking/pull/2672). + +####Fixed +* Fixed a crash related for objects that observe notifications but don't properly unregister. + * Fixed by [Kevin Harwood](https://github.com/Kevin Harwood) and [bnickle](https://github.com/bnickel) in [#2741](https://github.com/AFNetworking/AFNetworking/pull/2741). +* Fixed a race condition crash that occured with `AFImageResponseSerialization`. + * Fixed by [Paulo Ferreria](https://github.com/paulosotu) and [Kevin Harwood](https://github.com/Kevin Harwood) in [#2815](https://github.com/AFNetworking/AFNetworking/pull/2815). +* Fixed an issue where tests failed to run on CI due to unavailable simulators. + * Fixed by [Kevin Harwood](https://github.com/Kevin Harwood) in [#2834](https://github.com/AFNetworking/AFNetworking/pull/2834). +* Fixed "method override not found" warnings in Xcode 7 Betas + * Fixed by [Ben Guo](https://github.com/benzguo) in [#2822](https://github.com/AFNetworking/AFNetworking/pull/2822) +* Removed Duplicate Import and UIKit Header file. + * Fixed by [diehardest](https://github.com/diehardest) in [#2813](https://github.com/AFNetworking/AFNetworking/pull/2813) +* Removed the ability to include duplicate certificates in the pinned certificate chain. + * Fixed by [Kevin Harwood](https://github.com/Kevin Harwood) in [#2756](https://github.com/AFNetworking/AFNetworking/pull/2756). +* Fixed potential memory leak in `AFNetworkReachabilityManager`. + * Fixed by [Julien Cayzac](https://github.com/jcayzac) in [#2867](https://github.com/AFNetworking/AFNetworking/pull/2867). + +####Documentation Improvements +* Clarified best practices for Reachability per Apple recommendations. + * Fixed by [Steven Fisher](https://github.com/tewha) in [#2704](https://github.com/AFNetworking/AFNetworking/pull/2704). +* Added `startMonitoring` call to the Reachability section of the README + * Added by [Jawwad Ahmad](https://github.com/jawwad) in [#2831](https://github.com/AFNetworking/AFNetworking/pull/2831). +* Fixed documentation error around how `baseURL` is used for reachability monitoring. + * Fixed by [Kevin Harwood](https://github.com/Kevin Harwood) in [#2761](https://github.com/AFNetworking/AFNetworking/pull/2761). +* Numerous spelling corrections in the documentation. + * Fixed by [Antoine Cœur](https://github.com/Coeur) in [#2732](https://github.com/AFNetworking/AFNetworking/pull/2732) and [#2898](https://github.com/AFNetworking/AFNetworking/pull/2898). + +## [2.5.4](https://github.com/AFNetworking/AFNetworking/releases/tag/2.5.4) (2015-05-14) +Released on 2015-05-14. All issues associated with this milestone can be found using this [filter](https://github.com/AFNetworking/AFNetworking/issues?q=milestone%3A2.5.4+is%3Aclosed). + +####Updated +* Updated the CI test script to run iOS tests on all versions of iOS that are installed on the build machine. + * Updated by [Kevin Harwood](https://github.com/Kevin Harwood) in [#2716](https://github.com/AFNetworking/AFNetworking/pull/2716). + +####Fixed + +* Fixed an issue where `AFNSURLSessionTaskDidResumeNotification` and `AFNSURLSessionTaskDidSuspendNotification` were not being properly called due to implementation differences in `NSURLSessionTask` in iOS 7 and iOS 8, which also affects the `AFNetworkActivityIndicatorManager`. + * Fixed by [Kevin Harwood](https://github.com/Kevin Harwood) in [#2702](https://github.com/AFNetworking/AFNetworking/pull/2702). +* Fixed an issue where the OS X test linker would throw a warning during tests. + * Fixed by [Christian Noon](https://github.com/cnoon) in [#2719](https://github.com/AFNetworking/AFNetworking/pull/2719). +* Fixed an issue where tests would randomly fail due to mocked objects not being cleaned up. + * Fixed by [Kevin Harwood](https://github.com/Kevin Harwood) in [#2717](https://github.com/AFNetworking/AFNetworking/pull/2717). + + +## [2.5.3](https://github.com/AFNetworking/AFNetworking/releases/tag/2.5.3) (2015-04-20) + +* Add security policy tests for default policy + +* Add network reachability tests + +* Change `validatesDomainName` property to default to `YES` under all * security policies + +* Fix `NSURLSession` subspec compatibility with iOS 6 / OS X 10.8 + +* Fix leak of data task used in `NSURLSession` swizzling + +* Fix leak for observers from `addObserver:...:withBlock:` + +* Fix issue with network reachability observation on domain name + +## [2.5.2](https://github.com/AFNetworking/AFNetworking/releases/tag/2.5.2) (2015-03-26) +**NOTE** This release contains a security vulnerabilty. **All users should upgrade to a 2.5.3 or greater**. Please reference this [statement](https://gist.github.com/AlamofireSoftwareFoundation/f784f18f949b95ab733a) if you have any further questions about this release. + +* Add guards for unsupported features in iOS 8 App Extensions + +* Add missing delegate callbacks to `UIWebView` category + +* Add test and implementation of strict default certificate validation + +* Add #define for `NS_DESIGNATED_INITIALIZER` for unsupported versions of Xcode + +* Fix `AFNetworkActivityIndicatorManager` for iOS 7 + +* Fix `AFURLRequestSerialization` property observation + +* Fix `testUploadTasksProgressBecomesPartOfCurrentProgress` + +* Fix warnings from Xcode 6.3 Beta + +* Fix `AFImageWithDataAtScale` handling of animated images + +* Remove `AFNetworkReachabilityAssociation` enumeration + +* Update to conditional use assign semantics for GCD properties based on `OS_OBJECT_HAVE_OBJC_SUPPORT` for better Swift support + +## [2.5.1](https://github.com/AFNetworking/AFNetworking/releases/tag/2.5.1) (2015-02-09) +**NOTE** This release contains a security vulnerabilty. **All users should upgrade to a 2.5.3 or greater**. Please reference this [statement](https://gist.github.com/AlamofireSoftwareFoundation/f784f18f949b95ab733a) if you have any further questions about this release. + + * Add `NS_DESIGNATED_INITIALIZER` macros. (Samir Guerdah) + + * Fix and clarify documentation for `stringEncoding` property. (Mattt +Thompson) + + * Fix for NSProgress bug where two child NSProgress instances are added to a +parent NSProgress. (Edward Povazan) + + * Fix incorrect file names in headers. (Steven Fisher) + + * Fix KVO issue when running testing target caused by lack of +`automaticallyNotifiesObserversForKey:` implementation. (Mattt Thompson) + + * Fix use of variable arguments for UIAlertView category. (Kenta Tokumoto) + + * Fix `genstrings` warning for `NSLocalizedString` usage in +`UIAlertView+AFNetworking`. (Adar Porat) + + * Fix `NSURLSessionManager` task observation for network activity indicator +manager. (Phil Tang) + + * Fix `UIButton` category method caching of background image (Fernanda G. +Geraissate) + + * Fix `UIButton` category method failure handling. (Maxim Zabelin) + + * Update multipart upload method requirements to ensure `request.HTTPBody` +is non-nil. (Mattt Thompson) + + * Update to use builtin `__Require` macros from AssertMacros.h. (Cédric +Luthi) + + * Update `parameters` parameter to accept `id` for custom serialization +block. (@mooosu) + +## [2.5.0](https://github.com/AFNetworking/AFNetworking/releases/tag/2.5.0) (2014-11-17) + + * Add documentation for expected background session manager usage (Aaron +Brager) + + * Add missing documentation for `AFJSONRequestSerializer` and +`AFPropertyListSerializer` (Mattt Thompson) + + * Add tests for requesting HTTPS endpoints (Mattt Thompson) + + * Add `init` method declarations of `AFURLResponseSerialization` classes for +Swift compatibility (Allen Rohner) + + * Change default User-Agent to use the version number instead of the build +number (Tim Watson) + + * Change `validatesDomainName` to readonly property (Mattt Thompson, Brian +King) + + * Fix checks when observing `AFHTTPRequestSerializerObservedKeyPaths` (Jacek +Suliga) + + * Fix crash caused by attempting to set nil `NSURLResponse -URL` as key for +`userInfo` dictionary (Elvis Nuñez) + + * Fix crash for multipart streaming requests in XPC services (Mattt Thompson) + + * Fix minor aspects of response serializer documentation (Mattt Thompson) + + * Fix potential race condition for `AFURLConnectionOperation -description` + + * Fix widespread crash related to key-value observing of `NSURLSessionTask +-state` (Phil Tang) + + * Fix `UIButton` category associated object keys (Kristian Bauer, Mattt +Thompson) + + * Remove `charset` parameter from Content-Type HTTP header field values for +`AFJSONRequestSerializer` and `AFPropertyListSerializer` (Mattt Thompson) + + * Update CocoaDocs color scheme (@Orta) + + * Update Podfile to explicitly define sources (Kyle Fuller) + + * Update to relay `downloadFileURL` to the delegate if the manager picks a +`fileURL` (Brian King) + + * Update `AFSSLPinningModeNone` to not validate domain name (Brian King) + + * Update `UIButton` category to cache images in `sharedImageCache` (John +Bushnell) + + * Update `UIRefreshControl` category to set control state to current state +of request (Elvis Nuñez) + +## [2.4.1](https://github.com/AFNetworking/AFNetworking/releases/tag/2.4.1) (2014-09-04) + + * Fix compiler warning generated on 32-bit architectures (John C. Daub) + + * Fix potential crash caused by failed validation with nil responseData + (Mattt Thompson) + + * Fix to suppress compiler warnings for out-of-range enumerated type + value assignment (Mattt Thompson) + +## [2.4.0](https://github.com/AFNetworking/AFNetworking/releases/tag/2.4.0) (2014-09-03) + + * Add CocoaDocs color scheme (Orta) + + * Add image cache to `UIButton` category (Kristian Bauer, Mattt Thompson) + + * Add test for success block on 204 response (Mattt Thompson) + + * Add tests for encodable and re-encodable query string parameters (Mattt +Thompson) + + * Add `AFHTTPRequestSerializer -valueForHTTPHeaderField:` (Kyle Fuller) + + * Add `AFNetworkingOperationFailingURLResponseDataErrorKey` key to user info +of serialization error (Yannick Heinrich) + + * Add `imageResponseSerializer` property to `UIButton` category (Kristian +Bauer, Mattt Thompson) + + * Add `removesKeysWithNullValues` setting to serialization and copying (Jon +Shier) + + * Change request and response serialization tests to be factored out into +separate files (Mattt Thompson) + + * Change signature of success parameters in `UIButton` category methods to +match those in `UIImageView` (Mattt Thompson) + + * Change to remove charset parameter from +`application/x-www-form-urlencoded` content type (Mattt Thompson) + + * Change `AFImageCache` to conform to `NSObject` protocol ( Marcelo Fabri) + + * Change `AFMaximumNumberOfToRecreateBackgroundSessionUploadTask` to +`AFMaximumNumberOfAttemptsToRecreateBackgroundSessionUploadTask` (Mattt +Thompson) + + * Fix documentation error for NSSecureCoding (Robert Ryan) + + * Fix documentation for `URLSessionDidFinishEventsForBackgroundURLSession` +delegate method (Mattt Thompson) + + * Fix expired ADN certificate in example project (Carson McDonald) + + * Fix for interoperability within Swift project (Stephan Krusche) + + * Fix for potential deadlock due to KVO subscriptions within a lock +(Alexander Skvortsov) + + * Fix iOS 7 bug where session tasks can have duplicate identifiers if +created from different threads (Mattt Thompson) + + * Fix iOS 8 bug by adding explicit synthesis for `delegate` of +`AFMultipartBodyStream` (Mattt Thompson) + + * Fix issue caused by passing `nil` as body of multipart form part (Mattt +Thompson) + + * Fix issue caused by passing `nil` as destination in download task method +(Mattt Thompson) + + * Fix issue with `AFHTTPRequestSerializer` returning a request and silently +handling an error from a `queryStringSerialization` block (Kyle Fuller, Mattt +Thompson) + + * Fix potential issues by ensuring `invalidateSessionCancelingTasks` only +executes on main thread (Mattt Thompson) + + * Fix potential memory leak caused by deferred opening of output stream +(James Tomson) + + * Fix properties on session managers such that default values will not trump +values set in the session configuration (Mattt Thompson) + + * Fix README to include explicit call to start reachability manager (Mattt +Thompson) + + * Fix request serialization error handling in `AFHTTPSessionManager` +convenience methods (Kyle Fuller, Lars Anderson, Mattt Thompson) + + * Fix stray localization macro (Devin McKaskle) + + * Fix to ensure connection operation `-copyWithZone:` calls super +implementation (Chris Streeter) + + * Fix `UIButton` category to only cancel request for specified state +(@xuzhe, Mattt Thompson) + +## [2.3.1](https://github.com/AFNetworking/AFNetworking/releases/tag/2.3.1) (2014-06-13) + + * Fix issue with unsynthesized `streamStatus` & `streamError` properties +on `AFMultipartBodyStream` (Mattt Thompson) + +## [2.3.0](https://github.com/AFNetworking/AFNetworking/releases/tag/2.3.0) (2014-06-11) + + * Add check for `AF_APP_EXTENSIONS` macro to conditionally compile +background method that makes API call unavailable to App Extensions in iOS 8 +/ OS X 10.10 + + * Add further explanation for network reachability in documentation (Steven +Fisher) + + * Add notification for initial change from +`AFNetworkReachabilityStatusUnknown` to any other state (Jason Pepas, +Sebastian S.A., Mattt Thompson) + + * Add tests for AFNetworkActivityIndicatorManager (Dave Weston, Mattt +Thompson) + + * Add tests for AFURLSessionManager task progress (Ullrich Schäfer) + + * Add `attemptsToRecreateUploadTasksForBackgroundSessions` property, which +attempts Apple's recommendation of retrying a failed upload task if initial +creation did not succeed (Mattt Thompson) + + * Add `completionQueue` and `completionGroup` properties to +`AFHTTPRequestOperationManager` (Robert Ryan) + + * Change deprecating `AFErrorDomain` in favor of +`AFRequestSerializerErrorDomain` & `AFResponseSerializerErrorDomain` (Mattt +Thompson) + + * Change serialization tests to be split over two different files (Mattt +Thompson) + + * Change to make NSURLSession subspec not depend on NSURLConnection subspec +(Mattt Thompson) + + * Change to make Serialization subspec not depend on NSURLConnection subspec +(Nolan Waite, Mattt Thompson) + + * Change `completionHandler` of +`application:handleEventsForBackgroundURLSession:completion:` to be run on +main thread (Padraig Kennedy) + + * Change `UIImageView` category to accept any object conforming to +`AFURLResponseSerialization`, rather than just `AFImageResponseSerializer` +(Romans Karpelcevs) + + * Fix calculation and behavior of `NSProgress` (Padraig Kennedy, Ullrich +Schäfer) + + * Fix deprecation warning for `backgroundSessionConfiguration:` in iOS 8 / +OS X 10.10 (Mattt Thompson) + + * Fix implementation of `copyWithZone:` in serializer subclasses (Chris +Streeter) + + * Fix issue in Xcode 6 caused by implicit synthesis of overridden `NSStream` +properties (Clay Bridges, Johan Attali) + + * Fix KVO handling for `NSURLSessionTask` on iOS 8 / OS X 10.10 (Mattt +Thompson) + + * Fix KVO leak for `NSURLSessionTask` (@Zyphrax) + + * Fix potential crash caused by attempting to use non-existent error of +failing requests due to URLs exceeding a certain length (Boris Bügling) + + * Fix to check existence of `uploadProgress` block inside a referencing +`dispatch_async` to avoid potential race condition (Kyungkoo Kang) + + * Fix `UIImageView` category race conditions (Sunny) + + * Remove unnecessary default operation response serializer setters (Mattt +Thompson) + +## [2.2.4](https://github.com/AFNetworking/AFNetworking/releases/tag/2.2.4) (2014-05-13) + + * Add NSSecureCoding support to all AFNetworking classes (Kyle Fuller, Mattt +Thompson) + + * Change behavior of request operation `NSOutputStream` property to only nil +out if `responseData` is non-nil, meaning that no custom object was set +(Mattt Thompson) + + * Fix data tasks to not attempt to track progress, and rare related crash +(Padraig Kennedy) + + * Fix issue with `-downloadTaskDidFinishDownloading:` not being called +(Andrej Mihajlov) + + * Fix KVO leak on invalidated session tasks (Mattt Thompson) + + * Fix missing import of `UIRefreshControl+AFNetworking" (@BB9z) + + * Fix potential compilation errors on Mac OS X, caused by import order of +``, which signaled an incorrect deprecation warning (Mattt +Thompson) + + * Fix race condition in UIImageView+AFNetworking when making several image +requests in quick succession (Alexander Crettenand) + + * Update documentation for `-downloadTaskWithRequest:` to warn about blocks +being disassociated on app termination and backgrounding (Robert Ryan) + +## [2.2.3](https://github.com/AFNetworking/AFNetworking/releases/tag/2.2.3) (2014-04-18) + + * Fix `AFErrorOrUnderlyingErrorHasCodeInDomain` function declaration for +AFXMLDocumentResponseSerializer (Mattt Thompson) + + * Fix error domain check in `AFErrorOrUnderlyingErrorHasCodeInDomain` +(Mattt Thompson) + + * Fix `UIImageView` category to only `nil` out request operation properties +belonging to completed request (Mattt Thompson) + + * Fix `removesKeysWithNullValues` to respect +`NSJSONReadingMutableContainers` option (Mattt Thompson) + + * Change `removesKeysWithNullValues` property to recursively remove null +values from dictionaries nested in arrays (@jldagon) + + * Change to not override `Content-Type` header field values set by +`HTTPRequestHeaders` property (Aaron Brager, Mattt Thompson) + +## [2.2.2](https://github.com/AFNetworking/AFNetworking/releases/tag/2.2.2) (2014-04-15) + + * Add `removesKeysWithNullValues` property to `AFJSONResponsSerializer` to +automatically remove `NSNull` values in dictionaries serialized from JSON +(Mattt Thompson) + + * Add unit test for checking content type (Diego Torres) + + * Add `boundary` property to `AFHTTPBodyPart -copyWithZone:` + + * Change to accept `id` parameter type in HTTP manager convenience methods +(Mattt Thompson) + + * Change to deprecate `setAuthorizationHeaderFieldWithToken:`, in favor of +users specifying an `Authorization` header field value themselves (Mattt +Thompson) + + * Change to use `long long` type to prevent a difference in stream size +caps on 32-bit and 64-bit architectures (Yung-Luen Lan, Cédric Luthi) + + * Fix calculation of Content-Length in `taskDidSendBodyData` (Christos +Vasilakis) + + * Fix for comparison of image view request operations (Mattt Thompson) + + * Fix for SSL certificate validation to check status codes at runtime (Dave +Anderson) + + * Fix to add missing call to delegate in +`URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:` + + * Fix to call `taskDidComplete` if delegate is missing (Jeff Ward) + + * Fix to implement `respondsToSelector:` for `NSURLSession` delegate +methods to conditionally respond to conditionally respond to optional +selectors if and only if a custom block has been set (Mattt Thompson) + + * Fix to prevent illegal state values from being assigned for +`AFURLConnectionOperation` (Kyle Fuller) + + * Fix to re-establish `AFNetworkingURLSessionTaskDelegate` objects after +restoring from a background configuration (Jeff Ward) + + * Fix to reduce memory footprint by `nil`-ing out request operation +`outputStream` after closing, as well as image view request operation after +setting image (Teun van Run, Mattt Thompson) + + * Remove unnecessary call in class constructor (Bernhard Loibl) + + * Remove unnecessary check for `respondsToSelector:` for `UIScreen scale` +in User-Agent string (Samuel Goodwin) + + * Update App.net certificate and API base URL (Cédric Luthi) + + * Update examples in README (@petard, @orta, Mattt Thompson) + + * Update Travis CI icon to use SVG format (Maximilian Tagher) + +## [2.2.1](https://github.com/AFNetworking/AFNetworking/releases/tag/2.2.1) (2014-03-14) + + * Fix `-Wsign-conversion` warning in AFURLConnectionOperation (Jesse Collis) + + * Fix `-Wshorten-64-to-32` warning (Jesse Collis) + + * Remove unnecessary #imports in `UIImageView` & `UIWebView` categories +(Jesse Collis) + + * Fix call to `CFStringTransform()` by checking return value before setting +as `User-Agent` (Kevin Cassidy Jr) + + * Update `AFJSONResponseSerializer` adding `@autorelease` to relieve memory +pressure (Mattt Thompson, Michal Pietras) + + * Update `AFJSONRequestSerializer` to accept `id` (Daren Desjardins) + + * Fix small documentation bug (@jkoepcke) + + * Fix behavior of SSL pinning. In case of `validatesDomainName == YES`, it +now explicitly uses `SecPolicyCreateSSL`, which also validates the domain +name. Otherwise, `SecPolicyCreateBasicX509` is used. +`AFSSLPinningModeCertificate` now uses `SecTrustSetAnchorCertificates`, which +allows explicit specification of all trusted certificates. For +`AFSSLPinningModePublicKey`, the number of trusted public keys determines if +the server should be trusted. (Oliver Letterer, Eric Allam) + +## [2.2.0](https://github.com/AFNetworking/AFNetworking/releases/tag/2.2.0) (2014-02-25) + + * Add default initializer to make `AFHTTPRequestOperationManager` +consistent with `AFHTTPSessionManager` (Marcelo Fabri) + + * Add documentation about `UIWebView` category and implementing +`UIWebViewDelegate` (Mattt Thompson) + + * Add missing `NSCoding` and `NSCopying` implementations for +`AFJSONRequestSerializer` (Mattt Thompson) + + * Add note about use of `-startMonitoring` in +`AFNetworkReachabilityManager` (Mattt Thompson) + + * Add setter for needsNewBodyStream block (Carmen Cerino) + + * Add support for specifying a response serializer on a per-instance of +`AFURLSessionManagerTaskDelegate` (Blake Watters) + + * Add `AFHTTPRequestSerializer +-requestWithMultipartFormRequest:writingStreamContentsToFile:completionHandler +:` as a workaround for a bug in NSURLSession that removes the Content-Length +header from streamed requests (Mattt Thompson) + + * Add `NSURLRequest` factory properties on `AFHTTPRequestSerializer` (Mattt +Thompson) + + * Add `UIRefreshControl+AFNetworking` (Mattt Thompson) + + * Change example project to enable certificate pinning (JP Simard) + + * Change to allow self-signed certificates (Frederic Jacobs) + + * Change to make `reachabilityManager` property readwrite (Mattt Thompson) + + * Change to sort `NSSet` members during query string parameter +serialization (Mattt Thompson) + + * Change to use case sensitive compare when sorting keys in query string +serialization (Mattt Thompson) + + * Change to use xcpretty instead of xctool for automated testing (Kyle +Fuller, Marin Usalj, Carson McDonald) + + * Change to use `@selector` values as keys for associated objects (Mattt +Thompson) + + * Change `setImageWithURL:placeholder:`, et al. to only set placeholder +image if not `nil` (Alejandro Martinez) + + * Fix auto property synthesis warnings (Oliver Letterer) + + * Fix domain name validation for SSL certificates (Oliver Letterer) + + * Fix issue with session task delegate KVO observation (Kyle Fuller) + + * Fix placement of `baseURL` method declaration (Oliver Letterer) + + * Fix podspec linting error (Ari Braginsky) + + * Fix potential concurrency issues by adding lock around setting +`isFinished` state in `AFURLConnectionOperation` (Mattt Thompson) + + * Fix potential vulnerability caused by hard-coded multipart form data +boundary (Mathias Bynens, Tom Van Goethem, Mattt Thompson) + + * Fix protocol name in #pragma mark declaration (@sevntine) + + * Fix regression causing inflated images to have incorrect orientation +(Mattt Thompson) + + * Fix to `AFURLSessionManager` `NSCoding` implementation, to accommodate +`NSURLSessionConfiguration` no longer conforming to `NSCoding`. + + * Fix Travis CI integration (Kyle Fuller, Marin Usalj, Carson McDonald) + + * Fix various static analyzer warnings (Philippe Casgrain, Jim Young, +Steven Fisher, Mattt Thompson) + + * Fix with download progress calculation of completion units (Kyle Fuller) + + * Fix Xcode 5.1 compiler warnings (Nick Banks) + + * Fix `AFHTTPRequestOperationManager` to default +`shouldUseCredentialStorage` to `YES`, as documented (Mattt Thompson) + + * Remove Unused format property in `AFJSONRequestSerializer` (Mattt +Thompson) + + * Remove unused `acceptablePathExtensions` class method in +`AFJSONRequestSerializer` (Mattt Thompson) + + * Update #ifdef declarations in UIKit categories to be simpler (Mattt +Thompson) + + * Update podspec to includ social_media_url (Kyle Fuller) + + * Update types for 64 bit architecture (Bruno Tortato Furtado, Mattt +Thompson) + +## [2.1.0](https://github.com/AFNetworking/AFNetworking/releases/tag/2.1.0) (2014-01-16) + + * Add CONTRIBUTING (Kyle Fuller) + + * Add domain name verification for SSL certificates (Oliver Letterer) + + * Add leaf certificate checking (Alex Leverington, Carson McDonald, Mattt +Thompson) + + * Add test case for stream failure handling (Kyle Fuller) + + * Add underlying error properties to response serializers to forward errors +to subsequent validation steps (Mattt Thompson) + + * Add `AFImageCache` protocol, to allow for custom image caches to be +specified for `UIImageView` (Mattt Thompson) + + * Add `error` out parameter for request serializer, deprecating existing +request constructor methods (Adam Becevello) + + * Change request serializer protocol to take id type for parameters (Mattt +Thompson) + + * Change to add validation of download task responses (Mattt Thompson) + + * Change to force upload progress, by using original request Content-Length +(Mateusz Malczak) + + * Change to use `NSDictionary` object literals for `NSError` `userInfo` +construction (Mattt Thompson) + + * Fix #pragma declaration to be NSURLConnectionDataDelegate, rather than +NSURLConnectionDelegate (David Paschich) + + * Fix a bug when appending a file part to multipart request from a URL +(Kyle Fuller) + + * Fix analyzer warning about weak receiver being set to nil, capture strong +reference (Stewart Gleadow) + + * Fix appending file part to multipart request to use suggested file name, +rather than temporary one (Kyle Fuller) + + * Fix availability macros for network activity indicator (Mattt Thompson) + + * Fix crash in iOS 6.1 caused by KVO on `isCancelled` property of +`AFURLConnectionOperation` (Sam Page) + + * Fix dead store issues in `AFSecurityPolicy` (Andrew Hershberger) + + * Fix incorrect documentation for `-HTTPRequestOperationWithRequest:...` +(Kyle Fuller) + + * Fix issue in reachability callbacks, where reachability managers created +for a particular domain would initially report no reachability (Mattt +Thompson) + + * Fix logic for handling data task turning into download task (Kyle Fuller) + + * Fix property list response serializer to handle 204 response (Kyle Fuller) + + * Fix README multipart example (Johan Forssell) + + * Fix to add check for non-nil delegate in +`URLSession:didCompleteWithError:` (Kaom Te) + + * Fix to dramatically improve creation of images in +`AFInflatedImageFromResponseWithDataAtScale`, including handling of CMYK, 16 +/ 32 bpc images, and colorspace alpha settings (Robert Ryan) + + * Fix Travis CI integration and unit testing (Kyle Fuller, Carson McDonald) + + * Fix typo in comments (@palringo) + + * Fix UIWebView category to use supplied success callback (Mattt Thompson) + + * Fix various static analyzer warnings (Kyle Fuller, Jesse Collis, Mattt +Thompson) + + * Fix `+batchOfRequestOperations:...` completion block to execute in +`dispatch_async` (Mattt Thompson) + + * Remove synchronous `SCNetworkReachabilityGetFlags` call when initializing +managers, which had the potential to block in certain network conditions +(Yury Korolev, Mattt Thompson) + + * Remove unnecessary check for completionHandler in HTTP manager (Mattt +Thompson) + + * Remove unused conditional clauses (Luka Bratos) + + * Update documentation for `AFCompoundResponseSerializer` (Mattt Thompson) + + * Update httpbin certificates (Carson McDonald) + + * Update notification constant names to be consistent with `NSURLSession` +terminology (Mattt Thompson) + +## [2.0.3](https://github.com/AFNetworking/AFNetworking/releases/tag/2.0.3) (2013-11-18) + + * Fix a bug where `AFURLConnectionOperation -pause` did not correctly reset +the state of `AFURLConnectionOperation`, causing the Network Thread to enter +an infinite loop (Erik Chen) + + * Fix a bug where `AFURLConnectionOperation -cancel` does not set the +appropriate error on the `NSOperation` (Erik Chen) + + * Fix to post `AFNetworkingTaskDidFinishNotification` only on main queue +(Jakub Hladik) + + * Fix issue where the query string serialization block was not used (Kevin +Harwood) + + * Fix project file and repository directory items (Andrew Newdigate) + + * Fix `NSURLSession` subspec (Mattt Thompson) + + * Fix to session task delegate KVO by moving observer removal to +`-didCompleteWithError:` (Mattt Thompson) + + * Add AFNetworking 1.x behavior for image construction in inflation to +ensure correct orientation (Mattt Thompson) + + * Add `NSParameterAssert` for internal task constructors in order to catch +invalid constructions early (Mattt Thompson) + + * Update replacing `NSParameterAssert` with early `nil` return if session +was unable to create a task (Mattt Thompson) + + * Update `AFHTTPRequestOperationManager` and `AFHTTPSessionManager` to use +relative `self class` to create class constructor instances (Bogdan +Poplauschi) + + * Update to break out of loop if output stream does not have space to write +bytes (Mattt Thompson) + + * Update documentation and README with various fixes (Max Goedjen, Mattt +Thompson) + + * Remove unnecessary willChangeValueForKey and didChangeValueForKey method +calls (Mindaugas Vaičiūnas) + + * Remove deletion of all task delegates in +`URLSessionDidFinishEventsForBackgroundURLSession:` (Jeremy Mailen) + + * Remove empty, unused `else` branch (Luka Bratos) + +## [2.0.2](https://github.com/AFNetworking/AFNetworking/releases/tag/2.0.2) (2013-10-29) + + * Add `UIWebView + -loadRequest:MIMEType:textEncodingName:progress:success:failure:` (Mattt + Thompson) + + * Fix iOS 6 compatibility in `AFHTTPSessionManager` & + `UIProgressView+AFNetworking` (Olivier Halligon, Mattt Thompson) + + * Fix issue writing partial data to output stream (Kyle Fuller) + + * Fix behavior for `nil` response in request operations (Marcelo Fabri) + + * Fix implementation of + batchOfRequestOperations:progressBlock:completionBlock: for nil when passed + empty operations parameter (Mattt Thompson) + + * Update `AFHTTPSessionManager` to allow `-init` and `initWithConfig:` to + work (Ben Scheirman) + + * Update `AFRequestOperation` to default to `AFHTTPResponseSerializer` (Jiri + Techet) + + * Update `AFHTTPResponseSerializer` to remove check for nonzero responseData + length (Mattt Thompson) + + * Update `NSCoding` methods to use NSStringFromSelector(@selector()) pattern + instead of `NSString` literals (Mattt Thompson) + + * Update multipart form stream to set Content-Length after setting request + stream (Mattt Thompson) + + * Update documentation with outdated references to `AFHTTPSerializer` (Bruno + Koga) + + * Update documentation and README with various fixes (Jon Chambers, Mattt + Thompson) + + * Update files to remove executable privilege (Kyle Fuller) + +## 2.0.1 (2013-10-10) + + * Fix iOS 6 compatibility (Matt Baker, Mattt Thompson) + + * Fix example applications (Sam Soffes, Kyle Fuller) + + * Fix usage of `NSSearchPathForDirectoriesInDomains` in README (Leo Lou) + + * Fix names of exposed private methods `downloadProgress` and +`uploadProgress` (Hermes Pique) + + * Fix initial upload/download task progress updates (Vlas Voloshin) + + * Fix podspec to include `AFNetworking.h` `#import` (@haikusw) + + * Fix request serializers to not override existing header field values with +defaults (Mattt Thompson) + + * Fix unused format string placeholder (Thorsten Lockert) + + * Fix `AFHTTPRequestOperation -initWithCoder:` to call `super` (Josh Avant) + + * Fix `UIProgressView` selector name (Allen Tu) + + * Fix `UIButton` response serializer (Sam Grossberg) + + * Fix `setPinnedCertificates:` and pinned public keys (Kyle Fuller) + + * Fix timing of batched operation completion block (Denys Telezhkin) + + * Fix `GCC_WARN_ABOUT_MISSING_NEWLINE` compiler warning (Chuck Shnider) + + * Fix a format string missing argument issue in tests (Kyle Fuller) + + * Fix location of certificate chain bundle location (Kyle Fuller) + + * Fix memory leaks in AFSecurityPolicyTests (Kyle Fuller) + + * Fix potential concurrency issues in `AFURLSessionManager` by adding locks +around access to mutiple delegates dictionary (Mattt Thompson) + + * Fix unused variable compiler warnings by wrapping `OSStatus` and +`NSCAssert` with NS_BLOCK_ASSERTIONS macro (Mattt Thompson) + + * Fix compound serializer error handling (Mattt Thompson) + + * Fix string encoding for responseString (Juan Enrique) + + * Fix `UIImageView -setBackgroundImageWithRequest:` (Taichiro Yoshida) + + * Fix regressions nested multipart parameters (Mattt Thompson) + + * Add `responseObject` property to `AFHTTPRequestOperation` (Mattt Thompson) + + * Add support for automatic network reachability monitoring for request +operation and session managers (Mattt Thompson) + + * Update documentation and README with various corrections and fixes +(@haikusw, Chris Hellmuth, Dave Caunt, Mattt Thompson) + + * Update default User-Agent such that only ASCII character set is used +(Maximillian Dornseif) + + * Update SSL pinning mode to have default pinned certificates by default +(Kevin Harwood) + + * Update `AFSecurityPolicy` to use default authentication handling unless a +credential exists for the server trust (Mattt Thompson) + + * Update Prefix.pch (Steven Fisher) + + * Update minimum iOS test target to iOS 6 + + * Remove unused protection space block type (Kyle Fuller) + + * Remove unnecessary Podfile.lock (Kyle Fuller) + +## [2.0.0](https://github.com/AFNetworking/AFNetworking/releases/tag/2.0.0) (2013-09-27) + +* Initial 2.0.0 Release + +==================== +#AFNetworking 1.0 Change Log +-- + +## [1.3.4](https://github.com/AFNetworking/AFNetworking/releases/tag/1.3.4) (2014-04-15) + + * Fix `AFHTTPMultipartBodyStream` to randomly generate form boundary, to +prevent attack based on a known value (Mathias Bynens, Tom Van Goethem, Mattt +Thompson) + + * Fix potential non-terminating loop in `connection:didReceiveData:` (Mattt +Thompson) + + * Fix SSL certificate validation to provide a human readable Warning when +SSL Pinning fails (Maximillian Dornseif) + + * Fix SSL certificate validation to assert that no impossible pinning +configuration exists (Maximillian Dornseif) + + * Fix to check `CFStringTransform()` call for success before using result +(Kevin Cassidy Jr) + + * Fix to prevent unused assertion results with macros (Indragie Karunaratne) + + * Fix to call call `SecTrustEvaluate` before calling +`SecTrustGetCertificateCount` in SSL certificate validation (Josh Chung) + + * Fix to add explicit cast to `NSUInteger` in format string (Alexander +Kempgen) + + * Remove unused variable `kAFStreamToStreamBufferSize` (Alexander Kempgen) + +## [1.3.3](https://github.com/AFNetworking/AFNetworking/releases/tag/1.3.3) (2013-09-25) + + * Add stream error handling to `AFMultipartBodyStream` (Nicolas Bachschmidt, +Mattt Thompson) + + * Add stream error handling to `AFURLConnectionOperation +-connection:didReceiveData:` (Ian Duggan, Mattt Thompson) + + * Fix parameter query string encoding of square brackets according to RFC +3986 (Kra Larivain) + + * Fix AFHTTPBodyPart determination of end of input stream data (Brian Croom) + + * Fix unit test timeouts (Carson McDonald) + + * Fix truncated `User-Agent` header field when app contained non-ASCII +characters (Diego Torres) + + * Fix outdated link in documentation (Jonas Schmid) + + * Fix `AFHTTPRequestOperation` `HTTPError` property to be thread-safe +(Oliver Letterer, Mattt Thompson) + + * Fix API compatibility with iOS 5 (Blake Watters, Mattt Thompson) + + * Fix potential race condition in `AFURLConnectionOperation +-cancelConnection` (@mm-jkolb, Mattt Thompson) + + * Remove implementation of `connection:needNewBodyStream:` delegate method +in `AFURLConnectionOperation`, which fixes stream errors on authentication +challenges (Mattt Thompson) + + * Fix calculation of network reachability from flags (Tracy Pesin, Mattt +Thompson) + + * Update AFHTTPClient documentation to clarify scope of `parameterEncoding` +property (Thomas Catterall) + + * Update `UIImageView` category to allow for nested calls to +`setImageWithURLRequest:` (Philippe Converset) + + * Change `UIImageView` category to accept invalid SSL certificates when +`_AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES_` is defined (Flávio Caetano) + + * Change to replace #pragma clang with cast (Cédric Luthi) + +## [1.3.2](https://github.com/AFNetworking/AFNetworking/releases/tag/1.3.2) (2013-08-08) + + * Add return status checks when building list of pinned public keys (Sylvain +Guillope) + + * Add return status checks when handling connection authentication challenges +(Sylvain Guillope) + + * Add tests around `AFHTTPClient initWithBaseURL:` (Kyle Fuller) + + * Change to remove all `_AFNETWORKING_PIN_SSL_CERTIFICATES_` conditional +compilation (Dustin Barker) + + * Change to allow fallback to generic image loading when PNG/JPEG data +provider methods fail (Darryl H. Thomas) + + * Change to only set placeholder image if not `nil` (Mattt Thompson) + + * Change to use `response.MIMEType` rather than (potentially nonexistent) +Content-Type headers to determine image data provider (Mattt Thompson) + + * Fix image request test endpoint (Carson McDonald) + + * Fix compiler warning caused by `size_t` value defaulted to `NULL` (Darryl H. +Thomas) + + * Fix mutable headers property in `AFHTTPClient -copyWithZone:` (Oliver +Letterer) + + * Fix documentation and asset references in README (Romain Pouclet, Peter +Goldsmith) + + * Fix bug in examples always using `AFSSLPinningModeNone` (Dustin Barker) + + * Fix execution of tests under Travis (Blake Watters) + + * Fix static analyzer warnings about CFRelease calls to NULL pointer (Mattt +Thompson) + + * Change to return early in `AFGetMediaTypeAndSubtypeWithString` if string is +`nil` (Mattt Thompson) + + * Change to opimize network thread creation (Mattt Thompson) + +## [1.3.1](https://github.com/AFNetworking/AFNetworking/releases/tag/1.3.1) (2013-06-18) + + * Add `automaticallyInflatesResponseImage` property to +`AFImageRequestOperation`, which when enabled, offers significant performance +improvements for drawing images loaded through `UIImageView+AFNetworking` by +inflating compressed image data in the background (Mattt Thompson, Peter +Steinberger) + + * Add `NSParameterAssert` check for `nil` `urlRequest` parameter in +`AFURLConnectionOperation` initializer (Kyle Fuller) + + * Fix reachability to detect the case where a connection is required but can +be automatically established (Joshua Vickery) + + * Fix to Test target Podfile (Kyle Fuller) + +## [1.3.0](https://github.com/AFNetworking/AFNetworking/releases/tag/1.3.0) (2013-06-01) + + * Change in `AFURLConnectionOperation` `NSURLConnection` authentication +delegate methods and associated block setters. If +`_AFNETWORKING_PIN_SSL_CERTIFICATES_` is defined, +`-setWillSendRequestForAuthenticationChallengeBlock:` will be available, and +`-connection:willSendRequestForAuthenticationChallenge:` will be implemented. +Otherwise, `-setAuthenticationAgainstProtectionSpaceBlock:` & +`-setAuthenticationChallengeBlock:` will be available, and +`-connection:canAuthenticateAgainstProtectionSpace:` & +`-connection:didReceiveAuthenticationChallenge:` will be implemented instead +(Oliver Letterer) + + * Change in AFNetworking podspec to include Security framework (Kevin Harwood, +Oliver Letterer, Sam Soffes) + + * Change in AFHTTPClient to @throw exception when non-designated intializer is +used (Kyle Fuller) + + * Change in behavior of connection:didReceiveAuthenticationChallenge: to not +use URL-encoded credentials, which should already have been applied (@xjdrew) + + * Change to set AFJSONRequestOperation error when unable to decode response +string (Chris Pickslay, Geoff Nix) + + * Change AFURLConnectionOperation to lazily initialize outputStream property +(@fumoboy007) + + * Change instances of (CFStringRef)NSRunLoopCommonModes to +kCFRunLoopCommonModes + + * Change #warning to #pragma message for dynamic framework linking warnings +(@michael_r_may) + + * Add unit testing and continuous integration system (Blake Watters, Oliver +Letterer, Kevin Harwood, Cédric Luthi, Adam Fraser, Carson McDonald, Mattt +Thompson) + + * Fix multipart input stream implementation (Blake Watters, OliverLetterer, +Aleksey Kononov, @mattyohe, @mythodeia, @JD-) + + * Fix implementation of authentication delegate methods (Oliver Letterer, +Kevin Harwood) + + * Fix implementation of AFSSLPinningModePublicKey on Mac OS X (Oliver Letterer) + + * Fix error caused by loading file:// requests with AFHTTPRequestOperation +subclasses (Dave Anderson, Oliver Letterer) + + * Fix threading-related crash in AFNetworkActivityIndicatorManager (Dave Keck) + + * Fix to suppress GNU expression and enum assignment warnings from Clang +(Henrik Hartz) + + * Fix leak caused by CFStringConvertEncodingToIANACharSetName in AFHTTPClient +-requestWithMethod:path:parameters: (Daniel Demiss) + + * Fix missing __bridge casts in AFHTTPClient (@apouche, Mattt Thompson) + + * Fix Objective-C++ compatibility (Audun Holm Ellertsen) + + * Fix to not escape tildes (@joein3d) + + * Fix warnings caused by unsynthesized properties (Jeff Hunter) + + * Fix to network reachability calls to provide correct status on +initialization (@djmadcat, Mattt Thompson) + + * Fix to suppress warnings about implicit signedness conversion (Matt Rubin) + + * Fix AFJSONRequestOperation -responseJSON failing cases (Andrew Vyazovoy, +Mattt Thompson) + + * Fix use of object subscripting to avoid incompatibility with iOS < 6 and OS +X < 10.8 (Paul Melnikow) + + * Various fixes to reverted multipart stream provider implementation (Yaron +Inger, Alex Burgel) + +## [1.2.1](https://github.com/AFNetworking/AFNetworking/releases/tag/1.2.1) (2013-04-18) + + * Add `allowsInvalidSSLCertificate` property to `AFURLConnectionOperation` and +`AFHTTPClient`, replacing `_AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES_` macro +(Kevin Harwood) + + * Add SSL pinning mode to example project (Kevin Harwood) + + * Add name to AFNetworking network thread (Peter Steinberger) + + * Change pinned certificates to trust all derived certificates (Oliver +Letterer) + + * Fix documentation about SSL pinning (Kevin Harwood, Mattt Thompson) + + * Fix certain enumerated loops to use fast enumeration, resulting in better +performance (Oliver Letterer) + + * Fix macro to work correctly under Mac OS X 10.7 and iOS 4 SDK (Paul Melnikow) + + * Fix documentation, removing unsupported `@discussion` tags (Michele Titolo) + + * Fix `SecTrustCreateWithCertificates` expecting an array as first argument +(Oliver Letterer) + + * Fix to use `errSecSuccess` instead of `noErr` for Security frameworks +OSStatus (Oliver Letterer) + + * Fix `AFImageRequestOperation` to use `[self alloc]` instead of explicit +class, which allows for subclassing (James Clarke) + + * Fix for `numberOfFinishedOperations` calculations (Rune Madsen) + + * Fix calculation of data length in `-connection:didReceiveData:` +(Jean-Francois Morin) + + * Fix to encode JSON only with UTF-8, following recommendation of +`NSJSONSerialiation` (Sebastian Utz) + +## [1.2.0](https://github.com/AFNetworking/AFNetworking/releases/tag/1.2.0) (2013-03-24) + + * Add `SSLPinningMode` property to `AFHTTPClient` (Oliver Letterer, Kevin +Harwood, Adam Becevello, Dustin Barker, Mattt Thompson) + + * Add single quote ("'"), comma (","), and asterix ("*") to escaped URL +encoding characters (Eric Florenzano, Marc Nijdam, Garrett Murray) + + * Add `credential` property to `AFURLConnectionOperation` (Mattt Thompson) + + * Add `-setDefaultCredential:` to `AFHTTPClient` + + * Add `shouldUseCredentialStorage` property to `AFURLConnectionOperation` +(Mattt Thompson) + + * Add support for repeated key value pairs in `AFHTTPClient` URL query string +(Nick Dawson) + + * Add `AFMultipartFormData - +appendPartWithFileURL:name:fileName:mimeType:error` (Daniel Rodríguez Troitiño) + + * Add `AFMultipartFormData - +appendPartWithInputStream:name:fileName:mimeType:` (@joein3d) + + * Change SSL pinning to be runtime property on `AFURLConnectionOperation` +rather than defined by macro (Oliver Letterer) + + * Change `AFMultipartBodyStream` to `AFMultipartBodyStreamProvider`, vending +one side of a bound CFStream pair rather than subclassing `NSInputStream` (Mike +Ash) + + * Change default `Accept-Language` header in `AFHTTPClient` (@therigu, Mattt +Thompson) + + * Change `AFHTTPClient` operation cancellation to be based on request URL path +rather than absolute URL string (Mattt Thompson) + + * Change request operation subclass processing queues to use +`DISPATCH_QUEUE_CONCURRENT` (Mattt Thompson) + + * Change `UIImageView+AFNetworking` to resolve asymmetry in cached image case +between success block provided and not provided (@Eveets, Mattt Thompson) + + * Change `UIImageView+AFNetworking` to compare `NSURLRequest` instead of +`NSURL` to determine if previous request was equivalent (Cédric Luthi) + + * Change `UIImageView+AFNetworking` to only set image if non-`nil` (Sean +Kovacs) + + * Change indentation settings to four spaces at the project level (Cédric +Luthi) + + * Change `AFNetworkActivityIndicatorManager` to only update if requests have a +non-`nil` URL (Cédric Luthi) + + * Change `UIImageView+AFNetworking` to not do `setHTTPShouldHandleCookies` +(Konstantinos Vaggelakos) + + * Fix request stream exhaustion error on authentication challenges (Alex +Burgel) + + * Fix implementation to use `NSURL` methods instead of `CFURL` functions where +applicable (Cédric Luthi) + + * Fix race condition in `UIImageView+AFNetworking` (Peyman) + + * Fix `responseJSON`, `responseString`, and `responseStringEncoding` to be +threadsafe (Jon Parise, Mattt Thompson) + + * Fix `AFContentTypeForPathExtension` to ensure non-`NULL` content return +value (Zach Waugh) + + * Fix documentation for `appendPartWithFileURL:name:error:` + (Daniel Rodríguez Troitiño) + + * Fix request operation subclass processing queues to initialize with +`dispatch_once` (Sasmito Adibowo) + + * Fix posting of `AFNetworkingOperationDidStartNotification` and +`AFNetworkingOperationDidFinishNotification` to avoid crashes when logging in +response to notifications (Blake Watters) + + * Fix ordering of registered operation consultation in `AFHTTPClient` (Joel +Parsons) + + * Fix warning: multiple methods named 'postNotificationName:object:' found +[-Wstrict-selector-match] (Oliver Jones) + + * Fix warning: multiple methods named 'objectForKey:' found +[-Wstrict-selector-match] (Oliver Jones) + + * Fix warning: weak receiver may be unpredictably set to nil +[-Wreceiver-is-weak] (Oliver Jones) + + * Fix missing #pragma clang diagnostic pop (Steven Fisher) + +## [1.1.0](https://github.com/AFNetworking/AFNetworking/releases/tag/1.1.0) (2012-12-27) + + * Add optional SSL certificate pinning with `#define +_AFNETWORKING_PIN_SSL_CERTIFICATES_` (Dustin Barker) + + * Add `responseStringEncoding` property to `AFURLConnectionOperation` (Mattt +Thompson) + + * Add `userInfo` property to `AFURLConnectionOperation` (Mattt Thompson, +Steven Fisher) + + * Change behavior to cause a failure when an operation is cancelled (Daniel +Tull) + + * Change return type of class constructors to `instancetype` (@guykogus) + + * Change notifications to always being posted on an asynchronously-dispatched +block run on the main queue (Evadne Wu, Mattt Thompson) + + * Change from NSLocalizedString to NSLocalizedStringFromTable with +AFNetworking.strings table for localized strings (Cédric Luthi) + + * Change `-appendPartWithHeaders:body:` to add assertion handler for existence +of body data parameter (Jonathan Beilin) + + * Change `AFHTTPRequestOperation -responseString` to follow guidelines from +RFC 2616 regarding the use of string encoding when none is specified in the +response (Jorge Bernal) + + * Change AFHTTPClient parameter serialization dictionary keys with +`caseInsensitiveCompare:` to ensure + deterministic ordering of query string parameters, which may otherwise + cause ambiguous representations of nested parameters (James Coleman, + Mattt Thompson) + + * Fix -Wstrict-selector-match warnings raised by Xcode 4.6DP3 (Jesse Collis, +Cédric Luthi) + + * Fix NSJSONSerialization crash with Unicode character escapes in JSON +response (Mathijs Kadijk) + + * Fix issue with early return in -startMonitoringNetworkReachability if +network reachability object could not be created (i.e. invalid hostnames) +(Basil Shkara) + + * Fix retain cycles in AFImageRequestOperation.m and AFHTTPClient.m caused by +strong references within blocks (Nick Forge) + + * Fix issue caused by Rails behavior of returning a single space in head :ok +responses, which is interpreted as invalid (Sebastian Ludwig) + + * Fix issue in streaming multipart upload, where final encapsulation boundary +would not be appended if it was larger than the available buffer, causing a +potential timeout (Tomohisa Takaoka, David Kasper) + + * Fix memory leak of network reachability callback block (Mattt Thompson) + + * Fix `-initWithCoder:` for `AFURLConnectionOperation` and `AFHTTPClient` to +cast scalar types (Mattt Thompson) + + * Fix bug in `-enqueueBatchOfHTTPRequestOperations:...` to by using +`addOperations:waitUntilFinished:` instead of adding each operation +individually. (Mattt Thompson) + + * Change `#warning` messages of checks for `CoreServices` and +`MobileCoreServices` to message according to the build target platform (Mattt +Thompson) + + * Change `AFQueryStringFromParametersWithEncoding` to create keys string +representations using the description method as specified in documentation +(Cédric Luthi) + + * Fix __unused keywords for better Xcode indexing (Christian Rasmussen) + + * Fix warning: unused parameter 'x' [-Werror,-Wunused-parameter] (Oliver Jones) + + * Fix warning: property is assumed atomic by default +[-Werror,-Wimplicit-atomic-properties] (Oliver Jones) + + * Fix warning: weak receiver may be unpredictably null in ARC mode +[-Werror,-Wreceiver-is-weak] (Oliver Jones) + + * Fix warning: multiple methods named 'selector' found +[-Werror,-Wstrict-selector-match] (Oliver Jones) + + * Fix warning: 'macro' is not defined, evaluates to 0 (Oliver Jones) + + * Fix warning: atomic by default property 'X' has a user (Oliver Jones)defined +getter (property should be marked 'atomic' if this is intended) [-Werror, +-Wcustom-atomic-properties] (Oliver Jones) + + * Fix warning: 'response' was marked unused but was used +[-Werror,-Wused-but-marked-unused] (Oliver Jones) + + * Fix warning: enumeration value 'AFFinalBoundaryPhase' not explicitly handled +in switch [-Werror,-Wswitch-enum] (Oliver Jones) + +## [1.0.1](https://github.com/AFNetworking/AFNetworking/releases/tag/1.0.1) / 2012-11-01 + + * Fix error in multipart upload streaming, where byte range at boundaries +was not correctly calculated (Stan Chang Khin Boon) + + * If a success block is specified to `UIImageView -setImageWithURLRequest: +placeholderImage:success:failure`:, it is now the responsibility of the +block to set the image of the image view (Mattt Thompson) + + * Add `JSONReadingOptions` property to `AFJSONRequestOperation` (Jeremy + Foo, Mattt Thompson) + + * Using __weak self / __strong self pattern to break retain cycles in + background task and network reachability blocks (Jerry Beers, Dan Weeks) + + * Fix parameter encoding to leave period (`.`) unescaped (Diego Torres) + + * Fixing last file component in multipart form part creation (Sylver + Bruneau) + + * Remove executable permission on AFHTTPClient source files (Andrew + Sardone) + + * Fix warning (error with -Werror) on implicit 64 to 32 conversion (Dan + Weeks) + + * Add GitHub's .gitignore file (Nate Stedman) + + * Updates to README (@ckmcc) + +## [1.0](https://github.com/AFNetworking/AFNetworking/releases/tag/1.0) / 2012-10-15 + + * AFNetworking now requires iOS 5 / Mac OSX 10.7 or higher (Mattt Thompson) + + * AFNetworking now uses Automatic Reference Counting (ARC) (Mattt Thompson) + + * AFNetworking raises compiler warnings for missing features when +SystemConfiguration or CoreServices / MobileCoreServices frameworks are not +included in the project and imported in the precompiled headers (Mattt +Thompson) + + * AFNetworking now raises compiler error when not compiled with ARC (Steven +Fisher) + + * Add `NSCoding` and `NSCopying` protocol conformance to +`AFURLConnectionOperation` and `AFHTTPClient` (Mattt Thompson) + + * Add substantial improvements HTTP multipart streaming support, having +files streamed directly from disk and read sequentially from a custom input +stream (Max Lansing, Stan Chang Khin Boon, Mattt Thompson) + + * Add `AFMultipartFormData -throttleBandwidthWithPacketSize:delay:` as +workaround to issues when uploading over 3G (Mattt Thompson) + + * Add request and response to `userInfo` of errors returned from failing +`AFHTTPRequestOperation` (Mattt Thompson) + + * Add `userInfo` dictionary with current status in reachability changes +(Mattt Thompson) + + * Add `Accept` header for image requests in `UIImageView` category (Bratley +Lower) + + * Add explicit declaration of `NSURLConnection` delegate methods so that +they can be overridden in subclasses (Mattt Thompson, Evan Grim) + + * Add parameter validation to match conditions specified in documentation +(Jason Brennan, Mattt Thompson) + + * Add import to `UIKit` to avoid build errors from `UIDevice` references in +`User-Agent` default header (Blake Watters) + + * Remove `AFJSONUtilities` in favor of `NSJSONSerialization` (Mattt Thompson) + + * Remove `extern` declaration of `AFURLEncodedStringFromStringWithEncoding` +function (`CFURLCreateStringByAddingPercentEscapes` should be used instead) +(Mattt Thompson) + + * Remove `setHTTPShouldHandleCookies:NO` from `AFHTTPClient` (@phamsonha, +Mattt Thompson) + + * Remove `dispatch_retain` / `dispatch_release` with ARC in iOS 6 (Benoit +Bourdon) + + * Fix threading issue with `AFNetworkActivityIndicatorManager` (Eric Patey) + + * Fix issue where `AFNetworkActivityIndicatorManager` count could become +negative (@ap4y) + + * Fix properties to explicitly set options to suppress warnings (Wen-Hao +Lue, Mattt Thompson) + + * Fix compiler warning caused by mismatched types in upload / download +progress blocks (Gareth du Plooy, tomas.a) + + * Fix weak / strong variable relationships in `completionBlock` (Peter +Steinberger) + + * Fix string formatting syntax warnings caused by type mismatch (David +Keegan, Steven Fisher, George Cox) + + * Fix minor potential security vulnerability by explicitly using string +format in NSError localizedDescription value in userInfo (Steven Fisher) + + * Fix `AFURLConnectionOperation -pause` by adding state checks to prevent +likely memory issues when resuming (Mattt Thompson) + + * Fix warning caused by miscast of type when +`CLANG_WARN_IMPLICIT_SIGN_CONVERSION` is set (Steven Fisher) + + * Fix incomplete implementation warning in example code (Steven Fisher) + + * Fix warning caused by using `==` comparator on floats (Steven Fisher) + + * Fix iOS 4 bug where file URLs return `NSURLResponse` rather than +`NSHTTPURLResponse` objects (Leo Lobato) + + * Fix calculation of finished operations in batch operation progress +callback (Mattt Thompson) + + * Fix documentation typos (Steven Fisher, Matthias Wessendorf, +jorge@miv.uk.com) + + * Fix `hasAcceptableStatusCode` to return true after a network failure (Tony +Million) + + * Fix warning about missing prototype for private static method (Stephan +Diederich) + + * Fix issue where `nil` content type resulted in unacceptable content type +(Mattt Thompson) + + * Fix bug related to setup and scheduling of output stream (Stephen Tramer) + + * Fix AFContentTypesFromHTTPHeader to correctly handle comma-delimited +content types (Peyman, Mattt Thompson, @jsm174) + + * Fix crash caused by `_networkReachability` not being set to `NULL` after +releasing (Blake Watters) + + * Fix Podspec to correctly import required headers and use ARC (Eloy Durán, +Blake Watters) + + * Fix query string parameter escaping to leave square brackets unescaped +(Mattt Thompson) + + * Fix query string parameter encoding of `NSNull` values (Daniel Rinser) + + * Fix error caused by referencing `__IPHONE_OS_VERSION_MIN_REQUIRED` without +importing `Availability.h` (Blake Watters) + + * Update example to use App.net API, as Twitter shut off its unauthorized +access to the public timeline (Mattt Thompson) + + * Update `AFURLConnectionOperation` to replace `NSAutoReleasePool` with +`@autoreleasepool` (Mattt Thompson) + + * Update `AFHTTPClient` operation queue to specify +`NSOperationQueueDefaultMaxConcurrentOperationCount` rather than +previously-defined constant (Mattt Thompson) + + * Update `AFHTTPClient -initWithBaseURL` to automatically append trailing +slash, so as to fix common issue where default path is not respected without +trailing slash (Steven Fisher) + + * Update default `AFHTTPClient` `User-Agent` header strings (Mattt Thompson, +Steven Fisher) + + * Update icons for iOS example application (Mattt Thompson) + + * Update `numberOfCompletedOperations` variable in progress block to be +renamed to `numberOfFinishedOperations` (Mattt Thompson) + + +## 0.10.0 / 2012-06-26 + + * Add Twitter Mac Example application (Mattt Thompson) + + * Add note in README about how to set `-fno-objc-arc` flag for multiple files + at once (Pål Brattberg) + + * Add note in README about 64-bit architecture requirement (@rmuginov, Mattt + Thompson) + + * Add note in `AFNetworkActivityIndicatorManager` about not having to manually + manage animation state (Mattt Thompson) + + * Add missing block parameter name for `imageProcessingBlock` (Francois + Lambert) + + * Add NextiveJson to list of supported JSON libraries (Mattt Thompson) + + * Restore iOS 4.0 compatibility with `addAcceptableStatusCodes:` and + `addAcceptableContentTypes:` (Zachary Waldowski) + + * Update `AFHTTPClient` to use HTTP pipelining for `GET` and `HEAD` requests by + default (Mattt Thompson) + + * Remove @private ivar declaration in headers (Peter Steinberger, Mattt + Thompson) + + * Fix potential premature deallocation of _skippedCharacterSet (Tom Wanielista, + Mattt Thompson) + + * Fix potential issue in `setOutputStream` by closing any existing + `outputStream` (Mattt Thompson) + + * Fix filename in AFHTTPClient header (Steven Fisher) + + * Fix documentation for UIImageView+AFNetworking (Mattt Thompson) + + * Fix HTTP multipart form format, which caused issues with Tornado web server + (Matt Chen) + + * Fix `AFHTTPClient` to not append empty data into multipart form data (Jon + Parise) + + * Fix URL encoding normalization to not conditionally escape percent-encoded + strings (João Prado Maia, Kendall Helmstetter Gelner, @cysp, Mattt Thompson) + + * Fix `AFHTTPClient` documentation reference of + `HTTPRequestOperationWithRequest:success:failure` (Shane Vitarana) + + * Add `AFURLRequestOperation -setRedirectResponseBlock:` (Kevin Harwood) + + * Fix `AFURLConnectionOperation` compilation error by conditionally importing + UIKit framework (Steven Fisher) + + * Fix issue where image processing block is not called correctly with success + block in `AFImageRequestOperation` (Sergey Gavrilyuk) + + * Fix leaked dispatch group in batch operations (@andyegorov, Mattt Thompson) + + * Fix support for non-LLVM compilers in `AFNetworkActivityIndicatorManager` + (Abraham Vegh, Bill Williams, Mattt Thompson) + + * Fix AFHTTPClient to not add unnecessary data when constructing multipart form + request with nil parameters (Taeho Kim) + +## 1.0RC1 / 2012-04-25 + + * Add `AFHTTPRequestOperation +addAcceptableStatusCodes / ++addAcceptableContentTypes` to dynamically add acceptable status codes and +content types on the class level (Mattt Thompson) + + * Add support for compound and complex `Accept` headers that include multiple +content types and / or specify a particular character encoding (Mattt Thompson) + + * Add `AFURLConnectionOperation +-setShouldExecuteAsBackgroundTaskWithExpirationHandler:` to have operations +finish once an app becomes inactive (Mattt Thompson) + + * Add support for pausing / resuming request operations (Peter Steinberger, +Mattt Thompson) + + * Improve network reachability functionality in `AFHTTPClient`, including a +distinction between WWan and WiFi reachability (Kevin Harwood, Mattt Thompson) + + +## 0.9.2 / 2012-04-25 + + * Add thread safety to `AFNetworkActivityIndicator` (Peter Steinberger, Mattt +Thompson) + + * Document requirement of available JSON libraries for decoding responses in +`AFJSONRequestOperation` and parameter encoding in `AFHTTPClient` (Mattt +Thompson) + + * Fix `AFHTTPClient` parameter encoding (Mattt Thompson) + + * Fix `AFJSONEncode` and `AFJSONDecode` to use `SBJsonWriter` and +`SBJsonParser` instead of `NSObject+SBJson` (Oliver Eikemeier) + + * Fix bug where `AFJSONDecode` does not return errors (Alex Michaud) + + * Fix compiler warning for undeclared +`AFQueryStringComponentFromKeyAndValueWithEncoding` function (Mattt Thompson) + + * Fix cache policy for URL requests (Peter Steinberger) + + * Fix race condition bug in `UIImageView+AFNetworking` caused by incorrectly +nil-ing request operations (John Wu) + + * Fix reload button in Twitter example (Peter Steinberger) + + * Improve batched operation by deferring execution of batch completion block +until all component request completion blocks have finished (Patrick Hernandez, +Kevin Harwood, Mattt Thompson) + + * Improve performance of image request decoding by dispatching to background + queue (Mattt Thompson) + + * Revert `AFImageCache` to cache image objects rather than `NSPurgeableData` +(Tony Million, Peter Steinberger, Mattt Thompson) + + * Remove unnecessary KVO `willChangeValueForKey:` / `didChangeValueForKey:` +calls (Peter Steinberger) + + * Remove unnecessary @private ivar declarations in headers (Peter Steinberger, +Mattt Thompson) + + * Remove @try-@catch block wrapping network thread entry point (Charles T. Ahn) + + +## 0.9.1 / 2012-03-19 + + * Create Twitter example application (Mattt Thompson) + + * Add support for nested array and dictionary parameters for query string and +form-encoded requests (Mathieu Hausherr, Josh Chung, Mattt Thompson) + + * Add `AFURLConnectionOperation -setCacheResponseBlock:`, which allows the +behavior of the `NSURLConnectionDelegate` method +`-connection:willCacheResponse:` to be overridden without subclassing (Mattt +Thompson) + + * Add `_AFNETWORKING_ALLOW_INVALID_SSL_CERTIFICATES_` macros for +NSURLConnection authentication delegate methods (Mattt Thompson) + + * Add properties for custom success / failure callback queues (Peter +Steinberger) + + * Add notifications for network reachability changes to `AFHTTPClient` (Mattt +Thompson) + + * Add `AFHTTPClient -patchPath:` convenience method (Mattt Thompson) + + * Add support for NextiveJson (Adrian Kosmaczewski) + + * Improve network reachability checks (C. Bess) + + * Improve NSIndexSet formatting in error strings (Jon Parise) + + * Document crashing behavior in iOS 4 loading a file:// URL (Mattt Thompson) + + * Fix crash caused by `AFHTTPClient -cancelAllHTTPOperationsWithMethod:` not +checking operation to be instance of `AFHTTPRequestOperation` (Mattt Thompson) + + * Fix crash caused by passing `nil` URL in requests (Sam Soffes) + + * Fix errors caused by connection property not being nil'd out after an +operation finishes (Kevin Harwood, @zdzisiekpu) + + * Fix crash caused by passing `NULL` error pointer when setting `NSInvocation` +in `AFJSONEncode` and `AFJSONDecode` (Tyler Stromberg) + + * Fix batch operation completion block returning on background thread (Patrick +Hernandez) + + * Fix documentation for UIImageView+AFNetworking (Dominic Dagradi) + + * Fix race condition caused by `AFURLConnectionOperation` being cancelled on +main thread, rather than network thread (Erik Olsson) + + * Fix `AFURLEncodedStringFromStringWithEncoding` to correctly handle cases +where % is used as a literal rather than as part of a percent escape code +(Mattt Thompson) + + * Fix missing comma in `+defaultAcceptableContentTypes` for +`AFImageRequestOperation` (Michael Schneider) + + +## 0.9.0 / 2012-01-23 + + * Add thread-safe behavior to `AFURLConnectionOperation` (Mattt Thompson) + + * Add batching of operations for `AFHTTPClient` (Mattt Thompson) + + * Add authentication challenge callback block to override default + implementation of `connection:didReceiveAuthenticationChallenge:` in + `AFURLConnectionOperation` (Mattt Thompson) + + * Add `_AFNETWORKING_PREFER_NSJSONSERIALIZATION_`, which, when defined, + short-circuits the standard preference ordering used in `AFJSONEncode` and + `AFJSONDecode` to use `NSJSONSerialization` when available, falling back on + third-party-libraries. (Mattt Thompson, Shane Vitarana) + + * Add custom `description` for `AFURLConnectionOperation` and `AFHTTPClient` + (Mattt Thompson) + + * Add `text/javascript` to default acceptable content types for + `AFJSONRequestOperation` (Jake Boxer) + + * Add `imageScale` property to change resolution of images constructed from + cached data (Štěpán Petrů) + + * Add note about third party JSON libraries in README (David Keegan) + + * `AFQueryStringFromParametersWithEncoding` formats `NSArray` values in the + form `key[]=value1&key[]=value2` instead of `key=(value1,value2)` (Dan Thorpe) + + * `AFImageRequestOperation -responseImage` on OS X uses `NSBitmapImageRep` to + determine the correct pixel dimensions of the image (David Keegan) + + * `AFURLConnectionOperation` `connection` has memory management policy `assign` + to avoid retain cycles caused by `NSURLConnection` retaining its delegate + (Mattt Thompson) + + * `AFURLConnectionOperation` calls super implementation for `-isReady`, + following the guidelines for `NSOperation` subclasses (Mattt Thompson) + + * `UIImageView -setImageWithURL:` and related methods call success callback + after setting image (Cameron Boehmer) + + * Cancel request if an authentication challenge has no suitable credentials in + `AFURLConnectionOperation -connection:didReceiveAuthenticationChallenge:` + (Jorge Bernal) + + * Remove exception from + `multipartFormRequestWithMethod:path:parameters:constructing BodyWithBlock:` + raised when certain HTTP methods are used. (Mattt Thompson) + + * Remove `AFImageCache` from public API, moving it into private implementation + of `UIImageView+AFNetworking` (Mattt Thompson) + + * Mac example application makes better use of AppKit technologies and + conventions (Mattt Thompson) + + * Fix issue with multipart form boundaries in `AFHTTPClient + -multipartFormRequestWithMethod:path:parameters:constructing BodyWithBlock:` + (Ray Morgan, Mattt Thompson, Sam Soffes) + + * Fix "File Upload with Progress Callback" code snippet in README (Larry +Legend) + + * Fix to SBJSON invocations in `AFJSONEncode` and `AFJSONDecode` (Matthias + Tretter, James Frye) + + * Fix documentation for `AFHTTPClient requestWithMethod:path:parameters:` + (Michael Parker) + + * Fix `Content-Disposition` headers used for multipart form construction + (Michael Parker) + + * Add network reachability status change callback property to `AFHTTPClient`. + (Mattt Thompson, Kevin Harwood) + + * Fix exception handling in `AFJSONEncode` and `AFJSONDecode` (David Keegan) + + * Fix `NSData` initialization with string in `AFBase64EncodedStringFromString` + (Adam Ernst, Mattt Thompson) + + * Fix error check in `appendPartWithFileURL:name:error:` (Warren Moore, + Baldoph, Mattt Thompson) + + * Fix compiler warnings for certain configurations (Charlie Williams) + + * Fix bug caused by passing zero-length `responseData` to response object + initializers (Mattt Thompson, Serge Paquet) diff --git a/its/plugin/projects/AFNetworking/CONTRIBUTING.md b/its/plugin/projects/AFNetworking/CONTRIBUTING.md new file mode 100644 index 00000000..9bb98ead --- /dev/null +++ b/its/plugin/projects/AFNetworking/CONTRIBUTING.md @@ -0,0 +1,96 @@ +# Contributing Guidelines + +This document contains information and guidelines about contributing to this project. +Please read it before you start participating. + +**Topics** + +* [Asking Questions](#asking-questions) +* [Reporting Security Issues](#reporting-security-issues) +* [Reporting Issues](#reporting-other-issues) +* [Submitting Pull Requests](#submitting-pull-requests) +* [Developers Certificate of Origin](#developers-certificate-of-origin) +* [Code of Conduct](#code-of-conduct) + +## Asking Questions + +We don't use GitHub as a support forum. +For any usage questions that are not specific to the project itself, +please ask on [Stack Overflow](https://stackoverflow.com) instead. +By doing so, you'll be more likely to quickly solve your problem, +and you'll allow anyone else with the same question to find the answer. +This also allows maintainers to focus on improving the project for others. + +## Reporting Security Issues + +The Alamofire Software Foundation takes security seriously. +If you discover a security issue, please bring it to our attention right away! + +Please **DO NOT** file a public issue, +instead send your report privately to . +This will help ensure that any vulnerabilities that _are_ found +can be [disclosed responsibly](http://en.wikipedia.org/wiki/Responsible_disclosure) +to any affected parties. + +## Reporting Other Issues + +A great way to contribute to the project +is to send a detailed issue when you encounter an problem. +We always appreciate a well-written, thorough bug report. + +Check that the project issues database +doesn't already include that problem or suggestion before submitting an issue. +If you find a match, add a quick "+1" or "I have this problem too." +Doing this helps prioritize the most common problems and requests. + +When reporting issues, please include the following: + +* The version of Xcode you're using +* The version of iOS or OS X you're targeting +* The full output of any stack trace or compiler error +* A code snippet that reproduces the described behavior, if applicable +* Any other details that would be useful in understanding the problem + +This information will help us review and fix your issue faster. + +## Submitting Pull Requests + +Pull requests are welcome, and greatly encouraged. When submitting a pull request, please create proper test cases demonstrating the issue to be fixed or the new feature. + +## Developer's Certificate of Origin 1.1 + +By making a contribution to this project, I certify that: + +- (a) The contribution was created in whole or in part by me and I + have the right to submit it under the open source license + indicated in the file; or + +- (b) The contribution is based upon previous work that, to the best + of my knowledge, is covered under an appropriate open source + license and I have the right under that license to submit that + work with modifications, whether created in whole or in part + by me, under the same open source license (unless I am + permitted to submit under a different license), as indicated + in the file; or + +- (c) The contribution was provided directly to me by some other + person who certified (a), (b) or (c) and I have not modified + it. + +- (d) I understand and agree that this project and the contribution + are public and that a record of the contribution (including all + personal information I submit with it, including my sign-off) is + maintained indefinitely and may be redistributed consistent with + this project or the open source license(s) involved. + +## Code of Conduct + +The Code of Conduct governs how we behave in public or in private +whenever the project will be judged by our actions. +We expect it to be honored by everyone who contributes to this project. + +See [CONDUCT.md](https://github.com/Alamofire/Foundation/blob/master/CONDUCT.md) for details. + +--- + +*Some of the ideas and wording for the statements above were based on work by the [Docker](https://github.com/docker/docker/blob/master/CONTRIBUTING.md) and [Linux](http://elinux.org/Developer_Certificate_Of_Origin) communities. We commend them for their efforts to facilitate collaboration in their projects.* diff --git a/its/plugin/projects/AFNetworking/Framework/AFNetworking.h b/its/plugin/projects/AFNetworking/Framework/AFNetworking.h new file mode 100644 index 00000000..61a17eb8 --- /dev/null +++ b/its/plugin/projects/AFNetworking/Framework/AFNetworking.h @@ -0,0 +1,66 @@ +// AFNetworking.h +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import + +//! Project version number for AFNetworking. +FOUNDATION_EXPORT double AFNetworkingVersionNumber; + +//! Project version string for AFNetworking. +FOUNDATION_EXPORT const unsigned char AFNetworkingVersionString[]; + +// In this header, you should import all the public headers of your framework using statements like #import + +#import +#import + +#ifndef _AFNETWORKING_ +#define _AFNETWORKING_ + +#import +#import +#import + +#if !TARGET_OS_WATCH +#import +#endif + +#import +#import + +#if TARGET_OS_IOS || TARGET_OS_TV +#import +#import +#import +#import +#import +#import +#import +#endif + +#if TARGET_OS_IOS +#import +#import +#import +#endif + + +#endif /* _AFNETWORKING_ */ diff --git a/its/plugin/projects/AFNetworking/Framework/Info.plist b/its/plugin/projects/AFNetworking/Framework/Info.plist new file mode 100644 index 00000000..2a327732 --- /dev/null +++ b/its/plugin/projects/AFNetworking/Framework/Info.plist @@ -0,0 +1,26 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundlePackageType + FMWK + CFBundleShortVersionString + 3.0.0 + CFBundleSignature + ???? + CFBundleVersion + 3.0.4 + NSPrincipalClass + + + diff --git a/its/plugin/projects/AFNetworking/Framework/module.modulemap b/its/plugin/projects/AFNetworking/Framework/module.modulemap new file mode 100644 index 00000000..a9200e1d --- /dev/null +++ b/its/plugin/projects/AFNetworking/Framework/module.modulemap @@ -0,0 +1,5 @@ +framework module AFNetworking { + umbrella header "AFNetworking.h" + export * + module * { export * } +} \ No newline at end of file diff --git a/its/plugin/projects/AFNetworking/LICENSE b/its/plugin/projects/AFNetworking/LICENSE new file mode 100644 index 00000000..3fbc2c9a --- /dev/null +++ b/its/plugin/projects/AFNetworking/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/its/plugin/projects/AFNetworking/README.md b/its/plugin/projects/AFNetworking/README.md new file mode 100644 index 00000000..53cb2024 --- /dev/null +++ b/its/plugin/projects/AFNetworking/README.md @@ -0,0 +1,320 @@ +

+ AFNetworking +

+ +[![Build Status](https://travis-ci.org/AFNetworking/AFNetworking.svg)](https://travis-ci.org/AFNetworking/AFNetworking) +[![codecov.io](https://codecov.io/github/AFNetworking/AFNetworking/coverage.svg?branch=master)](https://codecov.io/github/AFNetworking/AFNetworking?branch=master) +[![CocoaPods Compatible](https://img.shields.io/cocoapods/v/AFNetworking.svg)](https://img.shields.io/cocoapods/v/AFNetworking.svg) +[![Carthage Compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage) +[![Platform](https://img.shields.io/cocoapods/p/AFNetworking.svg?style=flat)](http://cocoadocs.org/docsets/AFNetworking) +[![Twitter](https://img.shields.io/badge/twitter-@AFNetworking-blue.svg?style=flat)](http://twitter.com/AFNetworking) + +AFNetworking is a delightful networking library for iOS and Mac OS X. It's built on top of the [Foundation URL Loading System](http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/URLLoadingSystem/URLLoadingSystem.html), extending the powerful high-level networking abstractions built into Cocoa. It has a modular architecture with well-designed, feature-rich APIs that are a joy to use. + +Perhaps the most important feature of all, however, is the amazing community of developers who use and contribute to AFNetworking every day. AFNetworking powers some of the most popular and critically-acclaimed apps on the iPhone, iPad, and Mac. + +Choose AFNetworking for your next project, or migrate over your existing projects—you'll be happy you did! + +## How To Get Started + +- [Download AFNetworking](https://github.com/AFNetworking/AFNetworking/archive/master.zip) and try out the included Mac and iPhone example apps +- Read the ["Getting Started" guide](https://github.com/AFNetworking/AFNetworking/wiki/Getting-Started-with-AFNetworking), [FAQ](https://github.com/AFNetworking/AFNetworking/wiki/AFNetworking-FAQ), or [other articles on the Wiki](https://github.com/AFNetworking/AFNetworking/wiki) +- Check out the [documentation](http://cocoadocs.org/docsets/AFNetworking/) for a comprehensive look at all of the APIs available in AFNetworking +- Read the [AFNetworking 3.0 Migration Guide](https://github.com/AFNetworking/AFNetworking/wiki/AFNetworking-3.0-Migration-Guide) for an overview of the architectural changes from 2.0. + +## Communication + +- If you **need help**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/afnetworking). (Tag 'afnetworking') +- If you'd like to **ask a general question**, use [Stack Overflow](http://stackoverflow.com/questions/tagged/afnetworking). +- If you **found a bug**, _and can provide steps to reliably reproduce it_, open an issue. +- If you **have a feature request**, open an issue. +- If you **want to contribute**, submit a pull request. + +## Installation +AFNetworking supports multiple methods for installing the library in a project. + +## Installation with CocoaPods + +[CocoaPods](http://cocoapods.org) is a dependency manager for Objective-C, which automates and simplifies the process of using 3rd-party libraries like AFNetworking in your projects. See the ["Getting Started" guide for more information](https://github.com/AFNetworking/AFNetworking/wiki/Getting-Started-with-AFNetworking). You can install it with the following command: + +```bash +$ gem install cocoapods +``` + +> CocoaPods 0.39.0+ is required to build AFNetworking 3.0.0+. + +#### Podfile + +To integrate AFNetworking into your Xcode project using CocoaPods, specify it in your `Podfile`: + +```ruby +source 'https://github.com/CocoaPods/Specs.git' +platform :ios, '8.0' + +pod 'AFNetworking', '~> 3.0' +``` + +Then, run the following command: + +```bash +$ pod install +``` + +### Installation with Carthage + +[Carthage](https://github.com/Carthage/Carthage) is a decentralized dependency manager that builds your dependencies and provides you with binary frameworks. + +You can install Carthage with [Homebrew](http://brew.sh/) using the following command: + +```bash +$ brew update +$ brew install carthage +``` + +To integrate AFNetworking into your Xcode project using Carthage, specify it in your `Cartfile`: + +```ogdl +github "AFNetworking/AFNetworking" ~> 3.0 +``` + +Run `carthage` to build the framework and drag the built `AFNetworking.framework` into your Xcode project. + +## Requirements + +| AFNetworking Version | Minimum iOS Target | Minimum OS X Target | Minimum watchOS Target | Minimum tvOS Target | Notes | +|:--------------------:|:---------------------------:|:----------------------------:|:----------------------------:|:----------------------------:|:-------------------------------------------------------------------------:| +| 3.x | iOS 7 | OS X 10.9 | watchOS 2.0 | tvOS 9.0 | Xcode 7+ is required. `NSURLConnectionOperation` support has been removed. | +| 2.6 -> 2.6.3 | iOS 7 | OS X 10.9 | watchOS 2.0 | n/a | Xcode 7+ is required. | +| 2.0 -> 2.5.4 | iOS 6 | OS X 10.8 | n/a | n/a | Xcode 5+ is required. `NSURLSession` subspec requires iOS 7 or OS X 10.9. | +| 1.x | iOS 5 | Mac OS X 10.7 | n/a | n/a | +| 0.10.x | iOS 4 | Mac OS X 10.6 | n/a | n/a | + +(OS X projects must support [64-bit with modern Cocoa runtime](https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ObjCRuntimeGuide/Articles/ocrtVersionsPlatforms.html)). + +> Programming in Swift? Try [Alamofire](https://github.com/Alamofire/Alamofire) for a more conventional set of APIs. + +## Architecture + +### NSURLSession + +- `AFURLSessionManager` +- `AFHTTPSessionManager` + +### Serialization + +* `` + - `AFHTTPRequestSerializer` + - `AFJSONRequestSerializer` + - `AFPropertyListRequestSerializer` +* `` + - `AFHTTPResponseSerializer` + - `AFJSONResponseSerializer` + - `AFXMLParserResponseSerializer` + - `AFXMLDocumentResponseSerializer` _(Mac OS X)_ + - `AFPropertyListResponseSerializer` + - `AFImageResponseSerializer` + - `AFCompoundResponseSerializer` + +### Additional Functionality + +- `AFSecurityPolicy` +- `AFNetworkReachabilityManager` + +## Usage + +### AFURLSessionManager + +`AFURLSessionManager` creates and manages an `NSURLSession` object based on a specified `NSURLSessionConfiguration` object, which conforms to ``, ``, ``, and ``. + +#### Creating a Download Task + +```objective-c +NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; +AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration]; + +NSURL *URL = [NSURL URLWithString:@"http://example.com/download.zip"]; +NSURLRequest *request = [NSURLRequest requestWithURL:URL]; + +NSURLSessionDownloadTask *downloadTask = [manager downloadTaskWithRequest:request progress:nil destination:^NSURL *(NSURL *targetPath, NSURLResponse *response) { + NSURL *documentsDirectoryURL = [[NSFileManager defaultManager] URLForDirectory:NSDocumentDirectory inDomain:NSUserDomainMask appropriateForURL:nil create:NO error:nil]; + return [documentsDirectoryURL URLByAppendingPathComponent:[response suggestedFilename]]; +} completionHandler:^(NSURLResponse *response, NSURL *filePath, NSError *error) { + NSLog(@"File downloaded to: %@", filePath); +}]; +[downloadTask resume]; +``` + +#### Creating an Upload Task + +```objective-c +NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; +AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration]; + +NSURL *URL = [NSURL URLWithString:@"http://example.com/upload"]; +NSURLRequest *request = [NSURLRequest requestWithURL:URL]; + +NSURL *filePath = [NSURL fileURLWithPath:@"file://path/to/image.png"]; +NSURLSessionUploadTask *uploadTask = [manager uploadTaskWithRequest:request fromFile:filePath progress:nil completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) { + if (error) { + NSLog(@"Error: %@", error); + } else { + NSLog(@"Success: %@ %@", response, responseObject); + } +}]; +[uploadTask resume]; +``` + +#### Creating an Upload Task for a Multi-Part Request, with Progress + +```objective-c +NSMutableURLRequest *request = [[AFHTTPRequestSerializer serializer] multipartFormRequestWithMethod:@"POST" URLString:@"http://example.com/upload" parameters:nil constructingBodyWithBlock:^(id formData) { + [formData appendPartWithFileURL:[NSURL fileURLWithPath:@"file://path/to/image.jpg"] name:@"file" fileName:@"filename.jpg" mimeType:@"image/jpeg" error:nil]; + } error:nil]; + +AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]]; + +NSURLSessionUploadTask *uploadTask; +uploadTask = [manager + uploadTaskWithStreamedRequest:request + progress:^(NSProgress * _Nonnull uploadProgress) { + // This is not called back on the main queue. + // You are responsible for dispatching to the main queue for UI updates + dispatch_async(dispatch_get_main_queue(), ^{ + //Update the progress view + [progressView setProgress:uploadProgress.fractionCompleted]; + }); + } + completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) { + if (error) { + NSLog(@"Error: %@", error); + } else { + NSLog(@"%@ %@", response, responseObject); + } + }]; + +[uploadTask resume]; +``` + +#### Creating a Data Task + +```objective-c +NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; +AFURLSessionManager *manager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration]; + +NSURL *URL = [NSURL URLWithString:@"http://httpbin.org/get"]; +NSURLRequest *request = [NSURLRequest requestWithURL:URL]; + +NSURLSessionDataTask *dataTask = [manager dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) { + if (error) { + NSLog(@"Error: %@", error); + } else { + NSLog(@"%@ %@", response, responseObject); + } +}]; +[dataTask resume]; +``` + +--- + +### Request Serialization + +Request serializers create requests from URL strings, encoding parameters as either a query string or HTTP body. + +```objective-c +NSString *URLString = @"http://example.com"; +NSDictionary *parameters = @{@"foo": @"bar", @"baz": @[@1, @2, @3]}; +``` + +#### Query String Parameter Encoding + +```objective-c +[[AFHTTPRequestSerializer serializer] requestWithMethod:@"GET" URLString:URLString parameters:parameters error:nil]; +``` + + GET http://example.com?foo=bar&baz[]=1&baz[]=2&baz[]=3 + +#### URL Form Parameter Encoding + +```objective-c +[[AFHTTPRequestSerializer serializer] requestWithMethod:@"POST" URLString:URLString parameters:parameters error:nil]; +``` + + POST http://example.com/ + Content-Type: application/x-www-form-urlencoded + + foo=bar&baz[]=1&baz[]=2&baz[]=3 + +#### JSON Parameter Encoding + +```objective-c +[[AFJSONRequestSerializer serializer] requestWithMethod:@"POST" URLString:URLString parameters:parameters error:nil]; +``` + + POST http://example.com/ + Content-Type: application/json + + {"foo": "bar", "baz": [1,2,3]} + +--- + +### Network Reachability Manager + +`AFNetworkReachabilityManager` monitors the reachability of domains, and addresses for both WWAN and WiFi network interfaces. + +* Do not use Reachability to determine if the original request should be sent. + * You should try to send it. +* You can use Reachability to determine when a request should be automatically retried. + * Although it may still fail, a Reachability notification that the connectivity is available is a good time to retry something. +* Network reachability is a useful tool for determining why a request might have failed. + * After a network request has failed, telling the user they're offline is better than giving them a more technical but accurate error, such as "request timed out." + +See also [WWDC 2012 session 706, "Networking Best Practices."](https://developer.apple.com/videos/play/wwdc2012-706/). + +#### Shared Network Reachability + +```objective-c +[[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) { + NSLog(@"Reachability: %@", AFStringFromNetworkReachabilityStatus(status)); +}]; + +[[AFNetworkReachabilityManager sharedManager] startMonitoring]; +``` + +--- + +### Security Policy + +`AFSecurityPolicy` evaluates server trust against pinned X.509 certificates and public keys over secure connections. + +Adding pinned SSL certificates to your app helps prevent man-in-the-middle attacks and other vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged to route all communication over an HTTPS connection with SSL pinning configured and enabled. + +#### Allowing Invalid SSL Certificates + +```objective-c +AFHTTPSessionManager *manager = [AFHTTPSessionManager manager]; +manager.securityPolicy.allowInvalidCertificates = YES; // not recommended for production +``` + +--- + +## Unit Tests + +AFNetworking includes a suite of unit tests within the Tests subdirectory. These tests can be run simply be executed the test action on the platform framework you would like to test. + +## Credits + +AFNetworking is owned and maintained by the [Alamofire Software Foundation](http://alamofire.org). + +AFNetworking was originally created by [Scott Raymond](https://github.com/sco/) and [Mattt Thompson](https://github.com/mattt/) in the development of [Gowalla for iPhone](http://en.wikipedia.org/wiki/Gowalla). + +AFNetworking's logo was designed by [Alan Defibaugh](http://www.alandefibaugh.com/). + +And most of all, thanks to AFNetworking's [growing list of contributors](https://github.com/AFNetworking/AFNetworking/contributors). + +### Security Disclosure + +If you believe you have identified a security vulnerability with AFNetworking, you should report it as soon as possible via email to security@alamofire.org. Please do not post it to a public issue tracker. + +## License + +AFNetworking is released under the MIT license. See LICENSE for details. diff --git a/its/plugin/projects/AFNetworking/Tests/Info.plist b/its/plugin/projects/AFNetworking/Tests/Info.plist new file mode 100644 index 00000000..32379bec --- /dev/null +++ b/its/plugin/projects/AFNetworking/Tests/Info.plist @@ -0,0 +1,22 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIdentifier + com.alamofire.afnetworking.${PRODUCT_NAME:rfc1034identifier} + CFBundleInfoDictionaryVersion + 6.0 + CFBundlePackageType + BNDL + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1 + + diff --git a/its/plugin/projects/AFNetworking/Tests/Resources/ADN.net/ADNNetServerTrustChain/adn_0.cer b/its/plugin/projects/AFNetworking/Tests/Resources/ADN.net/ADNNetServerTrustChain/adn_0.cer new file mode 100644 index 0000000000000000000000000000000000000000..5cbf610fe652c33dab0c2f549e601ea2beb2133e GIT binary patch literal 1321 zcmXqLVpTP0V&PrD%*4pVB*5L(@Y3#O{b8vMhc`%ceT_8WW#iOp^Jx3d%gD&e%3zRY z$Zf#M#vIDRCd?EXY$$3V4B~JJ^SETDXF8`Al_+@TB^yc_h=YW=g$2sX%k@%#QprFm zz2y8{LsbK1kQB493|xmtW_pH#V{vh5QDR<<3ziM!u8p+Ps?OPR7gikGq)G; zu1Hh4nD@AP(YYhJv%7-2_vf%4$Yg9iu|>8!dzn<;s*Cf^Hb#clEK6`@W@tI)bo`mv{s z@V@J9MiGG(Wmz#FrGKW~%VEjeP$jB+xU%kQn(=&%S*Poa1>(;qMQ)z2`gY2%2W+|R ztao^L92DzusX*q+g6bnoa6>Bm;VSNHF28t z1u!`@)+smLxi{yZyT z{ubz;_molL%Du{&9?jpuF(AvwBE}-}?$4=%MRspl&2!f53%B@}Cs3s243QRO0mfhx zA`Y6^VUfWHGM=B2@jnX-GZX6qh;mhsayAZaHef(23?dA)7HBL` zYg5T6DJihh*H13WF-A$A`pJpLy6Hw1dO#UWwI;aLI)SWEV6ir^G%#o5Olb39Z2OzT z$Y`KtpaF9T6Qh_6$lhY0#pu~W-#H-IpcJWYWvnUH{=|*R>~$7rQ>n*uU3uy=Ci?faV9? z8{daWojCmG-d9!bCtsRY-{sh_WxG$+H&Z1GTe0o!mM(|)C^uZsmr(D0A#M|Ed{+Ml LSE!%Gvt}Lu*zU_* literal 0 HcmV?d00001 diff --git a/its/plugin/projects/AFNetworking/Tests/Resources/ADN.net/ADNNetServerTrustChain/adn_1.cer b/its/plugin/projects/AFNetworking/Tests/Resources/ADN.net/ADNNetServerTrustChain/adn_1.cer new file mode 100644 index 0000000000000000000000000000000000000000..683d5ff30ac23b7f8ef3ceacf01f82f08c278102 GIT binary patch literal 1628 zcmbtUdr*{B6u)=B-DLrRg%$9DumUnXl)VdxMv5$pK%&MY5H%LJj|D#6SG!9L$T+z= zOF4kSG%3W;PD+v^HX@>wfPzM*(rZi0d_)g5Lujl-@zJ>=j@I}`(>HS;=XZYR+~0kC zhggNV#41RzGd#@WiCywNmock-Ykj{Qb}&_oo+WNV=Wtu9?WP;X0s$ggxhruNGTD5g zgqNKq_a+i*xJV`?aYdX`W3ot})3fra#FxUZ5^-s1X=DMoSa3zM2Aw>Dgi#kG349ch z$`ut$6=rjZNv&r!(#1K_OoPE9RVs+TuN#?9Vn~!ciomzZ*DWdv%xG$WNech3npq@h zT#et;)F>5mqKOp;K7J5bfEX+GK!CgOtQeynwM&>dKy@!>UWRDYe=KlF-R}WYNWLlZ7T1^83TfLdxsEuIbY~Z&$S* zURc|^a=j{6dnD^KB#Md`7vzd1T>qr&jfolPmLTbR@IZOMP?cwwSIZ6WKm5w&9G<@G zm%Jkl+6~T4mot-=h~t8Odb@-9prx^W^*fHV*1D>J1D@f#=S`_@?>%((MPb$G{h+S7 zDn~{9hE49ZZwa>dwFUh6iRRk->+|fhPu*GYt#0Vl?KEZ83CE#kwO?C8N2u4u&e8mP zU$vbWUfAxRR^hj_KDKG$wcmCXt7cp*(yPXJ3`Tf|m3Nz1d4CaiIMNv&7~kjf;ZfP( zls=}2lyAjdV01z|Aaq@0OU1UkTFf9G06R&XP!u7AH|E5{K9R*1i!n|n`{(PCna$cc ztkFEjq%j)IoW)=&1F8<<3m!$&Y&rf`oQV`jkIIk~l^`?Hz-T~)&|6S3;sB8%C7>p- zIlwu@A~nn@j|HY47}R5dXo^z48ayn_jew|uLFbQWrB)Ke6hWKFO;<@rvIl+EgB*HP z03%gF`I*pbK_v(Iioi~X%v2NAtpLOXehtz=(*r6+r4Q7z&`TkX0}s_WK3Aicz@q4Q zJk?0oq8aI0bPc*U6YPNYeMcLh>!0zl6cX3l+c?M5g`mbj7ZGH z$z#k9B_Sku!Y0@@<>5UVShMkoGC($NrKtk=8!O4i%_PAdZ(m@Gd&p)@+UO_PvWcIQ zR*FZ3VsQ>F6G}xS@c*45=D%hLpn`(3U+J{nI_^5vjq`-WCkU; z^L_Y}(|rYoYm%I?#lf35p?u^-WH>THC$VJA%d7VdBw{-1r zMPt*v?=r2qYmfH_*Qcf=%l+$y+w+&l^uN&~KRUW^v+eUny!+yo9N|FRRrkHyEO}>M zZb-D`U#M1AT)3J&#G#XdOXX^H^cPc?-4b25KXZK6+=CIvJlf9x-h9wK_*h72by?}3 zvXK=ZRya9+xN~|HS+T(;PB||RICJOS-X2ns7rgt*t-bkcExiNl_9vg6*&XJnQF(up rxa4w_VduVe8Jlvu7wP)PzGG&dTHrk&& ztLnL}Q0ws3DJJQQxMViOXD)Ntcx3yg{tGjftaOaDx_oEKHJjTd7E8R&_^LL2_gWe( zWby8^XKvxdy5w!Em&G4m((=PUDRAG9qi=3oOnS`rlw%^#5e>)C->0KGMe7P*nC|y2 z;KS3U1MC5c*hY*|CU8utq&? zd&l;QPp7z6SghtsIkZ15c52JPg{pGxu~Grt3PNWbcjs{jTI}#X&BV;ez_>WsAklyi z7{#*ujEw(TSb)i@&43@o7Y6ZJ4VZzHfh)yU1V#fRgNzj0^gGw*%(v-CW8(-{yshZ|Lo0pNehH&82Z8W| zU7xFN3a0j%{+jp4b?dyFK8D^qCcbdi>Dyd!?)Ky0%ED_;6{j%X3T>aIlJc!9?aaM7 z=4V%!Y|Nakd}3aOl6Haf<4||QM9KFNM_cv%48AQe6jMI&{86fy@#+0i(hF>VoQmr< z>`vh5)a7A|3EF<-C)bRNqVe;E_SKjrTkLgNQvXCvo9oE*Ox~A0j}8cg?>JE=G%@s( zN9K(^T1?UWE>{!`Z-3cUpcXqJVcs5ZaZdd$r{$b8PO_^XycF~OmEz6}p*c2l_Rss% i5HmaZ>>Kx0s_N+r%s(?U)rMSO`QxRY@Z$0p@?HQubYDLJ literal 0 HcmV?d00001 diff --git a/its/plugin/projects/AFNetworking/Tests/Resources/Google.com/Equifax_Secure_Certificate_Authority_Root.cer b/its/plugin/projects/AFNetworking/Tests/Resources/Google.com/Equifax_Secure_Certificate_Authority_Root.cer new file mode 100644 index 0000000000000000000000000000000000000000..c44db27440eea7a3bb31f074f7e78371561bc439 GIT binary patch literal 804 zcmXqLVpcF{V(MJL%*4pV#A15y%XtG{HcqWJkGAi;jEtyK7--W?Eu}p{{{8NQ7Hh1uCKtoSIx(l&avIT2zvmmYJMblB(cXT9T1p zlvz?~AScdiX<=YtWMpV&VrXg@CC+Pz%%!@0jq{Ox#K_9P+}O)t(Ade;*vN1&c4I_3 zN7B0mvvlP-awm#p%;1vycZ(%oxFt#P@Wq;Q^I0G4VEo``^5#+3RF;%AAG3qwSvQ|f zZ`kj|)c5Z$Bj=lk3?lx2et+P(>%1#k`=NY8!A#Nc$zmV*r)OvT#K>w;01QT1d6rCrbc56d z$qN#f#2ds?H}DO44Y)yZ#VpL?9OPqYAO*5ffJN9qu#w-$05u*!3T63OSb!;m%|IT+ zQD%`a5Ni9zim?Tynv|}XXQT;yqDaXH{;!k|4}C{hi*zM48M0k@wKhia%E3OmNuvA zKkw=ni3M#yYhh_-T4IHvu7Ng4gj-kzDxwganp|3xs^FYjRFavNnVeXXs^C~!l96AO zSyE{rC(dhNWMFD!XkcOh1X1F=h86}EaIS$9s(oSxA`ts{-Ba^Jib{)16g=~i^$evA zBthcL!a{Iy_niEs#2f`@M}sCtC1h_fvNA9?G4eA2#krW87#SIEosmd3`1?g%St_h9 z`o2w$#goGA6%()QS$Mowf^~aVUEz{vM-rB8 zc;E1(Q-gn=>b1AcpVuy%czni5Cka!Lxoc;*P15r}^|9UgpxD%K-GKLn zRWmYrJAbccP2mx&T~(X99nfJ_DhYXeI*4sAAI+GJ;96w?KnRSYz&yu2LMu%guB{L-T2)MEXj)Pnrt%#!?~ zO5{WVOxw(jjSOWEh4TEo#e~`n*fuqCod3Xa{CHtq+Pgz=6OmQZF1=nXBf{aiZTHiO t@0-nD%ZBBjy0xb`dBT(WYCEOVw(M`?ElTD*W)ARMxPHdF#7`~uLID2>L2m#6 literal 0 HcmV?d00001 diff --git a/its/plugin/projects/AFNetworking/Tests/Resources/Google.com/GeoTrust_Global_CA_Root.cer b/its/plugin/projects/AFNetworking/Tests/Resources/Google.com/GeoTrust_Global_CA_Root.cer new file mode 100644 index 0000000000000000000000000000000000000000..4ae42e81b7ab27da185c149c5cfa42e0c7d8ef11 GIT binary patch literal 856 zcmXqLVh%BAVzODl%*4pV#LQ$8X28qFsnzDu_MMlJk(HIfz{!x?fRl|ml!Z;0DKywn z%s>Rh;S%O`Pt6Z0DlINi@XSlrGn6)v1c@^X3&F+RbMliCa}=B%4dldm4U7y-jSLM; z41gd?oYx4MOBFks7?qHn&dAEZ+{DPwV9>ZE`H0 z6mGAWcxBJR8$Lf)IB#Qq>8r@j(Qzw6Kh08eFKb2jT#Fa1+q3ElmpnU?ux!Koh9{jG z{PR?=y>0%ycG<+^Gfp~5n2O9@JHu^~p8u(j?al|qriSYVyzkU)s0v^E>0NyGC5GOe zB0oe#O>Z7>TU=dqV&eXjq1tCJOt+h(mU8C)xn{}2Q-05`T&-Ryc{cRki8q(xEP|iL z`1k1k3s5%ullJU%-x5nnhV4_CEGKgF{j<=!D9bwQo3C9yKfCOD9l8Dl%SXS=f`u)w z#HnfDwp}5z*XXqbvqlh0;nUT|wht|KvzxUf&8d7PX7DBcfcA^R>?c2&m>C%u7Y7>z z8t?-nN>-SW@jnZz0W**?kOc|wv52vV9H^R+(cAfZHERlwVC|~f)E%eJ_!-E9q?K7D z48$6+D?m*#z+h)&Fnz3<^;ADLq)#(o%KVv9B2W4&w34PQQcs_E;k;Cw`^$rymYl!q zD8=eG+xwkYerV8Um4)V9uT#pj^mIP|wJx2o|5xFS$AFMY+fH zHOmzG^_HFFIkah}E5q?~f`Lj(50<{#ChEbN@+!{1Q_AqwZO)}*gqX8t$jL%n|| zx;{<6pajCVfdT#lzY<`5?N(B`Y#Ht#t+bmWaeWL>aa)DSBl2kv#o#2RDJF?^AzyO7 zuV|nQ_>#+0Fk8SbW~QBhMdt9UM8pCSizoz;mkC(}5wsoeTv+t!tVYS{7rz&raP_Rd zezJI&O;r0p>Vu=$;I8v zqtkxd{V4K!{?>Vg!?l|#hsMx7x@*S5_VlYI&E5iU$8AmbL;nry=Tdc<@^)WQ``)I7 z$L@dA(|IJ0t*&oSq?R5U1wcjK5g=c)s28xP8>nG~>Lip4 zUOG>Lh{a(dBs3BNRq+mE@anq!Qi=K^v(B&d18%YtomatJN znAt&lEPM`XgH21tDcn)ckmj<$8sQT>X2w|_aIn+=dqQI*H5q^6nv6ZAtb(U^Vz_%M z;h931rYg+z6oqsB6oQ#L#Y^!#TL>N?%6P!)<^j8h2S|noC8tOO>8*&M9uwMS1DWCIIF1;>+Olkv)u z2E1V=*kZnE)$1$+`^1ex5Og&t0rMs>5N=PjGmI-kr*oB(Jo7qZZnhDI>}GgkBqTNm ztJU*o(B?8%@H$UNV^CFA9@u*&$@f6@Rcyb>(0d{0QC2CCbC+3(AmgYI2tXo-=AyGe z%x2a5cO)@!=bqZnct@+w{$Pr2EveFh*_=Rw#)4UJrVPFwP~>L0P>cYnL}IIw!w(Ap zoFoxV25*9-hPe&1Ll*z19tZ#348K6|-HZsd_fD?)W6<7OT`{w@`sMgw4fa;GuZ6wn z>gxTgpdfbUyVozM)$0?A>)U_1rfEr@FYc7L)p_2Fzra*I{}Z`yOUEjD;|fe8nMF@N z+;wkjtszP(*>rf>n!J(a8I5Z#_1cYtbCzbd)D`1xo-Hpj&b^@!D-v~SKE;d!1J53u?)eu?Lb)0M literal 0 HcmV?d00001 diff --git a/its/plugin/projects/AFNetworking/Tests/Resources/Google.com/GoogleComServerTrustChainPath1/googlecom_1.cer b/its/plugin/projects/AFNetworking/Tests/Resources/Google.com/GoogleComServerTrustChainPath1/googlecom_1.cer new file mode 100644 index 0000000000000000000000000000000000000000..521e439356a71e9f4d3c961a699a71a3e39271a2 GIT binary patch literal 1012 zcmXqLV*X&z#B^f;GZP~d6El-lnE@{wr&gOs+jm|@Mpjk^11Cdn15P&PP!={}rqEzR zF#{10hfA2(JvBe1sI<65!80#e&rsSx5+u$nECd&K&&f|p%u#T5G>{YLH8eIbF)%d* zLQ~TyAlJ;$$QX!BEln+>3_MZo5H=8m*umwVpP!zS3bMga)j%0yfec)*B(*3nwM4*a^M3LAGe6{B?Y;%s`RxZT1juU`Fgx7hC=Sf2|8Hfp+?=g% zueTt}>spn2&wle8@vRLX}#GsT|w};n`%#W_`E6QYIW@KPo-1yv} z@ri*vFhFIMStJa^8bl6M&B*BO{Jokrg-5VfV zv9;`LEHyT2jm&(v2kd#0n;BlBO{BF zfr5b?jBmi$CWK-_3djTlaga3%ECL3620UzBK&>o{*D9G<8IjWhFf{|y0waTZ&-s_f zt@j|VB`tHGQ z8!q!lJp8@!-<*YuU;I63|K)n&oxMFvBp)a$D~AgAFA-zntlPQ%-RQ_AqwZO)}*gqX8t$jL%n|| zx;{<6pajCVfdT#lzY<`5?N(B`Y#Ht#t+bmWaeWL>aa)DSBl2kv#o#2RDJF?^AzyO7 zuV|nQ_>#+0Fk8SbW~QBhMdt9UM8pCSizoz;mkC(}5wsoeTv+t!tVYS{7rz&raP_Rd zezJI&O;r0p>Vu=$;I8v zqtkxd{V4K!{?>Vg!?l|#hsMx7x@*S5_VlYI&E5iU$8AmbL;nry=Tdc<@^)WQ``)I7 z$L@dA(|IJ0t*&oSq?R5U1wcjK5g=c)s28xP8>nG~>Lip4 zUOG>Lh{a(dBs3BNRq+mE@anq!Qi=K^v(B&d18%YtomatJN znAt&lEPM`XgH21tDcn)ckmj<$8sQT>X2w|_aIn+=dqQI*H5q^6nv6ZAtb(U^Vz_%M z;h931rYg+z6oqsB6oQ#L#Y^!#TL>N?%6P!)<^j8h2S|noC8tOO>8*&M9uwMS1DWCIIF1;>+Olkv)u z2E1V=*kZnE)$1$+`^1ex5Og&t0rMs>5N=PjGmI-kr*oB(Jo7qZZnhDI>}GgkBqTNm ztJU*o(B?8%@H$UNV^CFA9@u*&$@f6@Rcyb>(0d{0QC2CCbC+3(AmgYI2tXo-=AyGe z%x2a5cO)@!=bqZnct@+w{$Pr2EveFh*_=Rw#)4UJrVPFwP~>L0P>cYnL}IIw!w(Ap zoFoxV25*9-hPe&1Ll*z19tZ#348K6|-HZsd_fD?)W6<7OT`{w@`sMgw4fa;GuZ6wn z>gxTgpdfbUyVozM)$0?A>)U_1rfEr@FYc7L)p_2Fzra*I{}Z`yOUEjD;|fe8nMF@N z+;wkjtszP(*>rf>n!J(a8I5Z#_1cYtbCzbd)D`1xo-Hpj&b^@!D-v~SKE;d!1J53u?)eu?Lb)0M literal 0 HcmV?d00001 diff --git a/its/plugin/projects/AFNetworking/Tests/Resources/Google.com/GoogleComServerTrustChainPath2/googlecom_1.cer b/its/plugin/projects/AFNetworking/Tests/Resources/Google.com/GoogleComServerTrustChainPath2/googlecom_1.cer new file mode 100644 index 0000000000000000000000000000000000000000..521e439356a71e9f4d3c961a699a71a3e39271a2 GIT binary patch literal 1012 zcmXqLV*X&z#B^f;GZP~d6El-lnE@{wr&gOs+jm|@Mpjk^11Cdn15P&PP!={}rqEzR zF#{10hfA2(JvBe1sI<65!80#e&rsSx5+u$nECd&K&&f|p%u#T5G>{YLH8eIbF)%d* zLQ~TyAlJ;$$QX!BEln+>3_MZo5H=8m*umwVpP!zS3bMga)j%0yfec)*B(*3nwM4*a^M3LAGe6{B?Y;%s`RxZT1juU`Fgx7hC=Sf2|8Hfp+?=g% zueTt}>spn2&wle8@vRLX}#GsT|w};n`%#W_`E6QYIW@KPo-1yv} z@ri*vFhFIMStJa^8bl6M&B*BO{Jokrg-5VfV zv9;`LEHyT2jm&(v2kd#0n;BlBO{BF zfr5b?jBmi$CWK-_3djTlaga3%ECL3620UzBK&>o{*D9G<8IjWhFf{|y0waTZ&-s_f zt@j|VB`tHGQ z8!q!lJp8@!-<*YuU;I63|K)n&oxMFvBp)a$D~AgAFA-zntlPQ%-RyYhh_-T4IHvu7Ng4gj-kzDxwganp|3xs^FYjRFavNnVeXXs^C~!l96AO zSyE{rC(dhNWMFD!XkcOh1X1F=h86}EaIS$9s(oSxA`ts{-Ba^Jib{)16g=~i^$evA zBthcL!a{Iy_niEs#2f`@M}sCtC1h_fvNA9?G4eA2#krW87#SIEosmd3`1?g%St_h9 z`o2w$#goGA6%()QS$Mowf^~aVUEz{vM-rB8 zc;E1(Q-gn=>b1AcpVuy%czni5Cka!Lxoc;*P15r}^|9UgpxD%K-GKLn zRWmYrJAbccP2mx&T~(X99nfJ_DhYXeI*4sAAI+GJ;96w?KnRSYz&yu2LMu%guB{L-T2)MEXj)Pnrt%#!?~ zO5{WVOxw(jjSOWEh4TEo#e~`n*fuqCod3Xa{CHtq+Pgz=6OmQZF1=nXBf{aiZTHiO t@0-nD%ZBBjy0xb`dBT(WYCEOVw(M`?ElTD*W)ARMxPHdF#7`~uLID2>L2m#6 literal 0 HcmV?d00001 diff --git a/its/plugin/projects/AFNetworking/Tests/Resources/Google.com/GoogleInternetAuthorityG2.cer b/its/plugin/projects/AFNetworking/Tests/Resources/Google.com/GoogleInternetAuthorityG2.cer new file mode 100644 index 0000000000000000000000000000000000000000..521e439356a71e9f4d3c961a699a71a3e39271a2 GIT binary patch literal 1012 zcmXqLV*X&z#B^f;GZP~d6El-lnE@{wr&gOs+jm|@Mpjk^11Cdn15P&PP!={}rqEzR zF#{10hfA2(JvBe1sI<65!80#e&rsSx5+u$nECd&K&&f|p%u#T5G>{YLH8eIbF)%d* zLQ~TyAlJ;$$QX!BEln+>3_MZo5H=8m*umwVpP!zS3bMga)j%0yfec)*B(*3nwM4*a^M3LAGe6{B?Y;%s`RxZT1juU`Fgx7hC=Sf2|8Hfp+?=g% zueTt}>spn2&wle8@vRLX}#GsT|w};n`%#W_`E6QYIW@KPo-1yv} z@ri*vFhFIMStJa^8bl6M&B*BO{Jokrg-5VfV zv9;`LEHyT2jm&(v2kd#0n;BlBO{BF zfr5b?jBmi$CWK-_3djTlaga3%ECL3620UzBK&>o{*D9G<8IjWhFf{|y0waTZ&-s_f zt@j|VB`tHGQ z8!q!lJp8@!-<*YuU;I63|K)n&oxMFvBp)a$D~AgAFA-zntlPQ%-RQ_AqwZO)}*gqX8t$jL%n|| zx;{<6pajCVfdT#lzY<`5?N(B`Y#Ht#t+bmWaeWL>aa)DSBl2kv#o#2RDJF?^AzyO7 zuV|nQ_>#+0Fk8SbW~QBhMdt9UM8pCSizoz;mkC(}5wsoeTv+t!tVYS{7rz&raP_Rd zezJI&O;r0p>Vu=$;I8v zqtkxd{V4K!{?>Vg!?l|#hsMx7x@*S5_VlYI&E5iU$8AmbL;nry=Tdc<@^)WQ``)I7 z$L@dA(|IJ0t*&oSq?R5U1wcjK5g=c)s28xP8>nG~>Lip4 zUOG>Lh{a(dBs3BNRq+mE@anq!Qi=K^v(B&d18%YtomatJN znAt&lEPM`XgH21tDcn)ckmj<$8sQT>X2w|_aIn+=dqQI*H5q^6nv6ZAtb(U^Vz_%M z;h931rYg+z6oqsB6oQ#L#Y^!#TL>N?%6P!)<^j8h2S|noC8tOO>8*&M9uwMS1DWCIIF1;>+Olkv)u z2E1V=*kZnE)$1$+`^1ex5Og&t0rMs>5N=PjGmI-kr*oB(Jo7qZZnhDI>}GgkBqTNm ztJU*o(B?8%@H$UNV^CFA9@u*&$@f6@Rcyb>(0d{0QC2CCbC+3(AmgYI2tXo-=AyGe z%x2a5cO)@!=bqZnct@+w{$Pr2EveFh*_=Rw#)4UJrVPFwP~>L0P>cYnL}IIw!w(Ap zoFoxV25*9-hPe&1Ll*z19tZ#348K6|-HZsd_fD?)W6<7OT`{w@`sMgw4fa;GuZ6wn z>gxTgpdfbUyVozM)$0?A>)U_1rfEr@FYc7L)p_2Fzra*I{}Z`yOUEjD;|fe8nMF@N z+;wkjtszP(*>rf>n!J(a8I5Z#_1cYtbCzbd)D`1xo-Hpj&b^@!D-v~SKE;d!1J53u?)eu?Lb)0M literal 0 HcmV?d00001 diff --git a/its/plugin/projects/AFNetworking/Tests/Resources/HTTPBin.org/AddTrust_External_CA_Root.cer b/its/plugin/projects/AFNetworking/Tests/Resources/HTTPBin.org/AddTrust_External_CA_Root.cer new file mode 100644 index 0000000000000000000000000000000000000000..8a99c54a99fbe7d188e8349044bbf835338815b0 GIT binary patch literal 1082 zcmXqLVlgvlVwPLL%*4pV#K>sC%f_kI=F#?@mywZ`mBAq2klTQhjX9KsO_(Xz)lkGh z2*lwM=5|a;2`MTqE>UoFGE_5A0f}-8%fdxnD@sy}@)C0tLP7!*{8CHG^NX?#l?)U> z>X?NkG1WOcDg@={ml(*2^BNc!m>L@x8kkrZTSSTT8XjN?rvBY=YQMRKuAJRO$F&7v$3OVnzc89ta_Yo{keA2e z`77qma!f!mNNh*Jt^yXWhK4aLSy*%>fBq$A#xwu(vU-c)21|O=7}o zpAG)XtF8Q7ZrndN|6ykS?(0t1vt6DXU;8fCF}^6Oki&d)W$Kd11yjtwGwAaknpAY_ zf<@77krl2-Vzp|wZ@G5l-I}w)F56FP-*skC{gt>gGb=(_aQkxO{;<->uV*!{yKU#v zPTh9dDPMHcj_TjoB)8i0+;|888*y*(5iaqn(`z5X>60`I?kALv!$}}rd+fLyRuno|Argo zyVp48xF<9RZun_r`~1&0HR0n8VoUc&{b@g6QQ4_D>yZyTSDWdcPxk_kT$;B1PMzPo zg1<7BuX&gPMRfc2iaj`Z->vky%Gx(yoVK)1E)YoHHJ8oQOX9M2)tNx2g;mKHpY2|F zRQr(GK4IQxdz0%btCw@~I;_sR+uwEg+qWJmC)U6#u3zUbPg2YfRdBYM`MhSY%8iv1 z#fv-a!=w!@B(@at&pLa8Z(g6C^uwMR&8OuJKf3rFV=4A5OW;5LW3PBaw%*G#K73KL eD)|+-^sdfJR+9^zH04HUoFGE_5A0f}-8%fdxnD@sy}@)C0t zLP7!*{8CHG^NX?#l?)U>>X?NkG1WOcDg@={ml(*2^BNc!m>L@x8kkrZTSSTT8Xr?e)pb%`8bxG1NBDgg8$LDi;*&sNkGhRFavNnVeXXnV+ZNSXz>i zUzAx=Y0$)k5>||?49rbT{0u;GE~X|XMuv$mLMC0}3fs7bSLN=}^DgNnGqueZ*D4n< z6z&PWf8>{zP``J*K-k{-1x4Ev>rZ;~i!Zl*yn!Y0-G9O9$G^1Mas9H3`8oNSN!3k} z?B{bfw=QU^DqCMT;rg4uyuaq;{JOuP>5E9+&wWRh>HF8utl#=4-MMHl55u+2*V#Ik z-}cXt5m{aL^l{#w8!MhnQn}@vowOtL@2i7*a<+AU=IfpHWOh#G%pVmV2Ci4vKIFA= zP55IpEl_<=`r%W0+p=G|9Y3zHV55BMJr9muOZ--TYIZYkdHv!{qla_4Uy;`An7uyI z8eK6;)mv82xcTluVDn*4H@{rFnZKrr->NYVceLpZe9OHpX1z|b)cx=i_IqB&9+|z~ zb>^eRQ7T(@tqik0pTFwAXT-h_EB=4kvG%3;?_E2-a9jO+;p`;Wd86gD@W-3GA9g0} z=+OvUBO*J8>v`ep^L%%0S58~#vDfDN`mMZ5J_iIF--KCzyS(U8^!80GNaN+QxRXU2R+|OyuVRJ3p-z1^F zk&nQT$}{_BWZ$b06!4^&QvNEyh26!5W#v54$m zU&mzoYuQJemcF&`EM~m9X=HQ-oQP%l85#exumE#yn*l#axiE;&YQPMn3#pvFxko}c zOOHQR=ZkHrGQ%Gu64I;-<~_|vo9`t L|Is>Mz#<<2E=x9y literal 0 HcmV?d00001 diff --git a/its/plugin/projects/AFNetworking/Tests/Resources/HTTPBin.org/COMODO_RSA_Domain_Validation_Secure_Server_CA.cer b/its/plugin/projects/AFNetworking/Tests/Resources/HTTPBin.org/COMODO_RSA_Domain_Validation_Secure_Server_CA.cer new file mode 100644 index 0000000000000000000000000000000000000000..7d7e8f271e43b37257755ed76258f83533d2fc98 GIT binary patch literal 1548 zcmXqLV&gDqV*apznTe5!NkCgK@72vxvmBAGyxWUwde{wk**LY@JlekVGBWb8G8iCn^}^YVyJDP36f(LR)Wd}1v@G@rxulDre!84 zmSpDVDL9svWaJlRmQ)(ZiSrto7#JBE8Gu2QIIoct%l>tM=+0mehQ3*LT8Ce;an;7{SfZ|+C zO^l2TeTSGNA1;Vo^4h|*SLZL|h0C4?QjT*cvAT*`typk?hpArn%tZKZm_Od`*m7q{&aV)n$~Wm>Ajm<9!v|rP#}>ot^b`a`{cO`cb&R;w)*7}tyvn1 z6Mge1`KvDdRAqWs?T*{h3u_`xd;a@PbPlkOoGh0UsQ4~IWc9z&fC@XG4Ki)Qzp`iS zd0;(7t~KZm^JEo?ywmD|uFneYsX8y=edx9H?Y6oTXLH}_$*LE}-f=Z(SoL_5Blr5f zF73B=K9!zZzwT*k(^4j8Mh3>kO^m6)5J@zU2Zph%GK++PScAy!^>s|Pzm|QpY3W=0 z&SJ)!n?^=g3}itH_*lePL?*1yvYHabePhBap|Iln&ReWBZaoL5JXwB5#{VoVz?9u) zAOun_4B~SbumLG1Mh1uxsw`p#B5WMmY>cd|?97aC7L$QANQ(lCh=Gs+8ygFd$zZ_2 z#+Kg5!^p&F-~*DBXK^)fHgH^EzreQ5I-{hdz)D{~xhO|3IX^c)B|kY4#L$PN5@2FR zNz3r0tOwL!PzbY@k&z|UAlbkg#y4PU(}x>eg2Q0Pl$4O7(&7?lN1$OP1}bpPjBOH7 z&H2g21t_|alOix&>YDMx+oW3Enqy18ignT4uqBKyHLAs>l?!)62EY2D)#s1!8 zy%OuLo^b8Ag>_ERqA5R|r0&1XXX|l2#Ky4d$%{KTw>~Vcc=Jv9&c(YqeNz2PUxn06 z+kW_8XkV{q+@F-)=k4}Rd!2c9{{xSYNlgMzdECN38Q;2aBKhqx`6;Z^yrd>x{QmlU zf6zK!j+=HX76iUL*j{q={z9+*dKSQ|d&3)hX>v9@we zoI;w^(w)n;S|0p5!}FgsLtM84&_yXI1PlgS;nsZ2K} z{M3DAepM>rLb}5B8&2G=>zgv}-Az+5pP)HK(oIrzN5l2gSK2hPTnf~blUB}e%iq6i qLcyi5^45y?uT)oxp9?7JVX#{D_;#|%{2y$EjE|ZWuKdg2yAc4zK1JmK literal 0 HcmV?d00001 diff --git a/its/plugin/projects/AFNetworking/Tests/Resources/HTTPBin.org/HTTPBinOrgServerTrustChain/httpbin_0.cer b/its/plugin/projects/AFNetworking/Tests/Resources/HTTPBin.org/HTTPBinOrgServerTrustChain/httpbin_0.cer new file mode 100644 index 0000000000000000000000000000000000000000..e2a2a3a13c337456dd97eac8f5ea0186c028edc0 GIT binary patch literal 1363 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 literal 0 HcmV?d00001 diff --git a/its/plugin/projects/AFNetworking/Tests/Resources/HTTPBin.org/HTTPBinOrgServerTrustChain/httpbin_2.cer b/its/plugin/projects/AFNetworking/Tests/Resources/HTTPBin.org/HTTPBinOrgServerTrustChain/httpbin_2.cer new file mode 100644 index 0000000000000000000000000000000000000000..ad75f0fc5419119a8f36aba983d42c13c6b18c82 GIT binary patch literal 1400 zcmXqLVl6RfVu@M6%*4pVB%q%5F6_1E=f2g~3l{xpxu;~n%f_kI=F#?@mywZ&mBAq2 zklTQhjX9KsO_(Xz)lkGh2*lwM=5|a;2`MTqE>UoFGE_5A0f}-8%fdxnD@sy}@)C0t zLP7!*{8CHG^NX?#l?)U>>X?NkG1WOcDg@={ml(*2^BNc!m>L@x8kkrZTSSTT8Xr?e)pb%`8bxG1NBDgg8$LDi;*&sNkGhRFavNnVeXXnV+ZNSXz>i zUzAx=Y0$)k5>||?49rbT{0u;GE~X|XMuv$mLMC0}3fs7bSLN=}^DgNnGqueZ*D4n< z6z&PWf8>{zP``J*K-k{-1x4Ev>rZ;~i!Zl*yn!Y0-G9O9$G^1Mas9H3`8oNSN!3k} z?B{bfw=QU^DqCMT;rg4uyuaq;{JOuP>5E9+&wWRh>HF8utl#=4-MMHl55u+2*V#Ik z-}cXt5m{aL^l{#w8!MhnQn}@vowOtL@2i7*a<+AU=IfpHWOh#G%pVmV2Ci4vKIFA= zP55IpEl_<=`r%W0+p=G|9Y3zHV55BMJr9muOZ--TYIZYkdHv!{qla_4Uy;`An7uyI z8eK6;)mv82xcTluVDn*4H@{rFnZKrr->NYVceLpZe9OHpX1z|b)cx=i_IqB&9+|z~ zb>^eRQ7T(@tqik0pTFwAXT-h_EB=4kvG%3;?_E2-a9jO+;p`;Wd86gD@W-3GA9g0} z=+OvUBO*J8>v`ep^L%%0S58~#vDfDN`mMZ5J_iIF--KCzyS(U8^!80GNaN+QxRXU2R+|OyuVRJ3p-z1^F zk&nQT$}{_BWZ$b06!4^&QvNEyh26!5W#v54$m zU&mzoYuQJemcF&`EM~m9X=HQ-oQP%l85#exumE#yn*l#axiE;&YQPMn3#pvFxko}c zOOHQR=ZkHrGQ%Gu64I;-<~_|vo9`t L|Is>Mz#<<2E=x9y literal 0 HcmV?d00001 diff --git a/its/plugin/projects/AFNetworking/Tests/Resources/HTTPBin.org/HTTPBinOrgServerTrustChain/httpbin_3.cer b/its/plugin/projects/AFNetworking/Tests/Resources/HTTPBin.org/HTTPBinOrgServerTrustChain/httpbin_3.cer new file mode 100644 index 0000000000000000000000000000000000000000..8a99c54a99fbe7d188e8349044bbf835338815b0 GIT binary patch literal 1082 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 C5GTO^ literal 0 HcmV?d00001 diff --git a/its/plugin/projects/AFNetworking/Tests/Resources/SelfSigned/NoDomains.cer b/its/plugin/projects/AFNetworking/Tests/Resources/SelfSigned/NoDomains.cer new file mode 100644 index 0000000000000000000000000000000000000000..6b6cce65b21e82464a994fba6adf62f91033f9de GIT binary patch literal 747 zcmXqLVtQ`S#CU!IGZP~d6Cch)(a~+BasKOyt0xXl z-dT96N^bKTtv!yyUtYc|vAeJ_ru$`f{|imV=L)Pke@<0|d^-0vr1p97^7l7d<}7Eb zx3tlg^jH2+)g=~t|0#oxn#OjYf7~-e3NrL3vN=3YmAP@-y7!A=&>cMqMrP@rt#Nsx z#xuV9vFv*!-y`4mO!rlA26I%J^XbjYmc6nxR*%oW=y>qiYx&LX7gm?1AO4t>9s9I% zoz0;qHNP%6$Fpb(ihen?b~j`5t@*!>@cvn}Z|_Fnpxf~eW?C1Hy!;P7k85tNCYZ+)5@Bsr}mYKV5 z;`11Av2kd#F|x9VA$XW7w0mq(AHyKi2Rrvogz3O0Hs`KvLdZ(Dk6ZQ6~wg7P<$ l&U`IAmc;PtPVPiMXT~|ay+>B>sAE01`uZC?uH~n%0RVpbD^UOd literal 0 HcmV?d00001 diff --git a/its/plugin/projects/AFNetworking/Tests/Resources/SelfSigned/foobar.com.cer b/its/plugin/projects/AFNetworking/Tests/Resources/SelfSigned/foobar.com.cer new file mode 100644 index 0000000000000000000000000000000000000000..a9ca08eacdf4a860b3968195a0029ee3f66a5faf GIT binary patch literal 747 zcmXqLVtQ`S#CU!IGZP~d6CYP(-PYdE{;!(t>LUMDyb!A~dNqwpaF*et zY0>(}lc#(re#`Y%(E7L5WM($!{{8Qnm>C%u7i$@481MlDUY4Jc@jnX-GZTA*ff$Id z3gYt^aItY{voW%=vNJOxhbA{TG#MF6uN{rBjGvgG*qHxvscT`w_4S-;cR!bx2`m(n zEm+0f&N{obB4i3Q5p zTN>^1rQ~CBIu?3tNN8m^|2b5C{+h=p^NnPWna(mf5%lPB`-}&gJ9F3t&aRuWeS3-G z-H=B2)n6a3INoG|k!;bn&{sudNlqEhmf6Cc>%TM{dDRPJGh{+Cye z%_Q2-gSgeG|T0nf|@GeD}@W4;@Pv lzx~K+m9W*`cV5*6;|0=u+y2>~Tm5-ef%^1nBfrZ*dH@)(EGYm0 literal 0 HcmV?d00001 diff --git a/its/plugin/projects/AFNetworking/Tests/Resources/logo.png b/its/plugin/projects/AFNetworking/Tests/Resources/logo.png new file mode 100644 index 0000000000000000000000000000000000000000..4fc5a3c9104eed904619d378fa48907c200e52e8 GIT binary patch literal 14795 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 literal 0 HcmV?d00001 diff --git a/its/plugin/projects/AFNetworking/Tests/Tests-Prefix.pch b/its/plugin/projects/AFNetworking/Tests/Tests-Prefix.pch new file mode 100644 index 00000000..eb2007ec --- /dev/null +++ b/its/plugin/projects/AFNetworking/Tests/Tests-Prefix.pch @@ -0,0 +1,9 @@ +// +// Prefix header +// +// The contents of this file are implicitly included at the beginning of every source file. +// + +#ifdef __OBJC__ + #import +#endif diff --git a/its/plugin/projects/AFNetworking/Tests/Tests/AFAutoPurgingImageCacheTests.m b/its/plugin/projects/AFNetworking/Tests/Tests/AFAutoPurgingImageCacheTests.m new file mode 100644 index 00000000..add2301f --- /dev/null +++ b/its/plugin/projects/AFNetworking/Tests/Tests/AFAutoPurgingImageCacheTests.m @@ -0,0 +1,233 @@ +// AFAutoPurgingImageCacheTests.m +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import +#import "AFAutoPurgingImageCache.h" + +@interface AFAutoPurgingImageCacheTests : XCTestCase +@property (nonatomic, strong) AFAutoPurgingImageCache *cache; +@property (nonatomic, strong) UIImage *testImage; +@end + +@implementation AFAutoPurgingImageCacheTests + +- (void)setUp { + [super setUp]; + self.cache = [[AFAutoPurgingImageCache alloc] initWithMemoryCapacity:100 * 1024 * 1024 + preferredMemoryCapacity:60 * 1024 * 1024]; + + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"logo" ofType:@"png"]; + self.testImage = [UIImage imageWithContentsOfFile:path]; + + +} + +- (void)tearDown { + [self.cache removeAllImages]; + self.cache = nil; + self.testImage = nil; + [super tearDown]; +} + +#pragma mark - Cache Return Images + +- (void)testImageIsReturnedFromCacheForIdentifier { + NSString *identifier = @"logo"; + [self.cache addImage:self.testImage withIdentifier:identifier]; + + UIImage *cachedImage = [self.cache imageWithIdentifier:identifier]; + XCTAssertEqual(self.testImage, cachedImage, @"Cached image should equal original image"); +} + +- (void)testImageIsReturnedFromCacheForURLRequest { + NSURL *url = [NSURL URLWithString:@"http://test.com/image"]; + NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url]; + [self.cache addImage:self.testImage forRequest:request withAdditionalIdentifier:nil]; + + UIImage *cachedImage = [self.cache imageforRequest:request withAdditionalIdentifier:nil]; + XCTAssertEqual(self.testImage, cachedImage, @"Cached image should equal original image"); +} + +- (void)testImageIsReturnedFromCacheForURLRequestWithAdditionalIdentifier { + NSURL *url = [NSURL URLWithString:@"http://test.com/image"]; + NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url]; + NSString *additionalIdentifier = @"filter"; + [self.cache addImage:self.testImage forRequest:request withAdditionalIdentifier:additionalIdentifier]; + + UIImage *cachedImage = [self.cache imageforRequest:request withAdditionalIdentifier:additionalIdentifier]; + XCTAssertEqual(self.testImage, cachedImage, @"Cached image should equal original image"); +} + +- (void)testImageIsNotReturnedWhenAdditionalIdentifierIsNotSet { + NSURL *url = [NSURL URLWithString:@"http://test.com/image"]; + NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url]; + NSString *additionalIdentifier = @"filter"; + [self.cache addImage:self.testImage forRequest:request withAdditionalIdentifier:additionalIdentifier]; + + UIImage *cachedImage = [self.cache imageforRequest:request withAdditionalIdentifier:nil]; + XCTAssertNil(cachedImage, @"cached image should be nil"); +} + +- (void)testImageIsNotReturnedWhenURLDoesntMatch { + NSURL *url = [NSURL URLWithString:@"http://test.com/image"]; + NSURLRequest *originalRequest = [[NSURLRequest alloc] initWithURL:url]; + [self.cache addImage:self.testImage forRequest:originalRequest withAdditionalIdentifier:nil]; + + NSURL *newURL = [NSURL URLWithString:@"http://test.com/differentImage"]; + NSURLRequest *newRequest = [[NSURLRequest alloc] initWithURL:newURL]; + UIImage *cachedImage = [self.cache imageforRequest:newRequest withAdditionalIdentifier:nil]; + XCTAssertNil(cachedImage, @"cached image should be nil"); +} + +- (void)testDuplicateImageAddedToCacheIsReturned { + NSURL *url = [NSURL URLWithString:@"http://test.com/image"]; + NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url]; + [self.cache addImage:self.testImage forRequest:request withAdditionalIdentifier:nil]; + + NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"logo" ofType:@"png"]; + UIImage *newImage = [UIImage imageWithContentsOfFile:path]; + + [self.cache addImage:newImage forRequest:request withAdditionalIdentifier:nil]; + + UIImage *cachedImage = [self.cache imageforRequest:request withAdditionalIdentifier:nil]; + XCTAssertEqual(cachedImage, newImage); + XCTAssertNotEqual(cachedImage, self.testImage); +} + +#pragma mark - Remove Image Tests + +- (void)testImageIsRemovedWithIdentifier { + NSString *identifier = @"logo"; + [self.cache addImage:self.testImage withIdentifier:identifier]; + XCTAssertTrue([self.cache removeImageWithIdentifier:identifier], @"image should be reported as removed"); + XCTAssertFalse([self.cache removeImageWithIdentifier:identifier], @"image should be reported as removed the second time"); + UIImage *cachedImage = [self.cache imageWithIdentifier:identifier]; + XCTAssertNil(cachedImage, @"cached image should be nil"); +} + +- (void)testImageIsRemovedWithURLRequest { + NSURL *url = [NSURL URLWithString:@"http://test.com/image"]; + NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url]; + [self.cache addImage:self.testImage forRequest:request withAdditionalIdentifier:nil]; + XCTAssertTrue([self.cache removeImageforRequest:request withAdditionalIdentifier:nil], @"image should be reported as removed"); + XCTAssertFalse([self.cache removeImageforRequest:request withAdditionalIdentifier:nil], @"image should be reported as removed the second time"); + UIImage *cachedImage = [self.cache imageforRequest:request withAdditionalIdentifier:nil]; + XCTAssertNil(cachedImage, @"cached image should be nil"); +} + +- (void)testImageIsRemovedWithURLRequestWithAdditionalIdentifier { + NSURL *url = [NSURL URLWithString:@"http://test.com/image"]; + NSString *identifier = @"filter"; + NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url]; + [self.cache addImage:self.testImage forRequest:request withAdditionalIdentifier:identifier]; + XCTAssertTrue([self.cache removeImageforRequest:request withAdditionalIdentifier:identifier], @"image should be reported as removed"); + XCTAssertFalse([self.cache removeImageforRequest:request withAdditionalIdentifier:identifier], @"image should be reported as removed the second time"); + UIImage *cachedImage = [self.cache imageforRequest:request withAdditionalIdentifier:identifier]; + XCTAssertNil(cachedImage, @"cached image should be nil"); +} + +- (void)testImageIsNotRemovedWithURLRequestAndNilIdentifier { + NSURL *url = [NSURL URLWithString:@"http://test.com/image"]; + NSString *identifier = @"filter"; + NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url]; + [self.cache addImage:self.testImage forRequest:request withAdditionalIdentifier:identifier]; + XCTAssertFalse([self.cache removeImageforRequest:request withAdditionalIdentifier:nil], @"image should not be reported as removed"); + UIImage *cachedImage = [self.cache imageforRequest:request withAdditionalIdentifier:identifier]; + XCTAssertNotNil(cachedImage, @"cached image should be nil"); +} + +- (void)testImageIsNotRemovedWithURLRequestAndIncorrectIdentifier { + NSURL *url = [NSURL URLWithString:@"http://test.com/image"]; + NSString *identifier = @"filter"; + NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url]; + [self.cache addImage:self.testImage forRequest:request withAdditionalIdentifier:identifier]; + NSString *differentIdentifier = @"nofilter"; + XCTAssertFalse([self.cache removeImageforRequest:request withAdditionalIdentifier:differentIdentifier], @"image should not be reported as removed"); + UIImage *cachedImage = [self.cache imageforRequest:request withAdditionalIdentifier:identifier]; + XCTAssertNotNil(cachedImage, @"cached image should be nil"); +} + +#pragma mark - Memory Usage +- (void)testThatMemoryUsageIncreasesWhenAddingImage { + NSString *identifier = @"logo"; + XCTAssertTrue(self.cache.memoryUsage == 0); + [self.cache addImage:self.testImage withIdentifier:identifier]; + XCTAssertTrue(self.cache.memoryUsage == 13600); +} + +- (void)testThatMemoryUsageDecreasesWhenRemovingImage { + NSString *identifier = @"logo"; + [self.cache addImage:self.testImage withIdentifier:identifier]; + UInt64 currentUsage = self.cache.memoryUsage; + [self.cache removeImageWithIdentifier:identifier]; + XCTAssertTrue(currentUsage > self.cache.memoryUsage); +} + +#pragma mark - Purging +- (void)testThatImagesArePurgedWhenCapcityIsReached { + UInt64 imageSize = 13600; + NSInteger numberOfImages = 10; + NSInteger numberOfImagesAfterPurge = 6; + self.cache = [[AFAutoPurgingImageCache alloc] initWithMemoryCapacity:numberOfImages * imageSize preferredMemoryCapacity:numberOfImagesAfterPurge * imageSize]; + NSInteger index = 1; + while (YES) { + NSString * identifier = [NSString stringWithFormat:@"image-%ld",(long)index]; + [self.cache addImage:self.testImage withIdentifier:identifier]; + if (index <= numberOfImages) { + XCTAssertTrue(self.cache.memoryUsage == index * imageSize); + } else { + XCTAssertTrue(self.cache.memoryUsage == numberOfImagesAfterPurge * imageSize); + break; + } + index++; + } +} + +- (void)testThatPrioritizedImagesWithOldestLastAccessDatesAreRemovedDuringPurge { + UInt64 imageSize = 13600; + NSInteger numberOfImages = 10; + NSInteger numberOfImagesAfterPurge = 6; + self.cache = [[AFAutoPurgingImageCache alloc] initWithMemoryCapacity:numberOfImages * imageSize preferredMemoryCapacity:numberOfImagesAfterPurge * imageSize]; + for (NSInteger index = 0; index < numberOfImages; index ++) { + NSString * identifier = [NSString stringWithFormat:@"image-%ld",(long)index]; + [self.cache addImage:self.testImage withIdentifier:identifier]; + } + + NSString * firstIdentifier = [NSString stringWithFormat:@"image-%ld",(long)0]; + UIImage *firstImage = [self.cache imageWithIdentifier:firstIdentifier]; + XCTAssertNotNil(firstImage, @"first image should not be nil"); + UInt64 prePurgeMemoryUsage = self.cache.memoryUsage; + [self.cache addImage:self.testImage withIdentifier:[NSString stringWithFormat:@"image-%ld",(long)10]]; + UInt64 postPurgeMemoryUsage = self.cache.memoryUsage; + XCTAssertTrue(postPurgeMemoryUsage < prePurgeMemoryUsage); + + for (NSInteger index = 0; index <= numberOfImages ; index++) { + NSString * identifier = [NSString stringWithFormat:@"image-%ld",(long)index]; + UIImage *cachedImage = [self.cache imageWithIdentifier:identifier]; + if (index == 0 || index >= 6) { + XCTAssertNotNil(cachedImage, @"Image for %@ should be cached", identifier); + } else { + XCTAssertNil(cachedImage, @"Image for %@ should not be cached", identifier); + } + } +} + +@end diff --git a/its/plugin/projects/AFNetworking/Tests/Tests/AFCompoundResponseSerializerTests.m b/its/plugin/projects/AFNetworking/Tests/Tests/AFCompoundResponseSerializerTests.m new file mode 100644 index 00000000..247ce8b6 --- /dev/null +++ b/its/plugin/projects/AFNetworking/Tests/Tests/AFCompoundResponseSerializerTests.m @@ -0,0 +1,89 @@ +// AFURLSessionManagerTests.m +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import +#import "AFTestCase.h" +#import "AFURLResponseSerialization.h" + +@interface AFCompoundResponseSerializerTests : AFTestCase + +@end + +@implementation AFCompoundResponseSerializerTests + +- (void)setUp { + [super setUp]; + // Put setup code here. This method is called before the invocation of each test method in the class. +} + +- (void)tearDown { + // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; +} + +#pragma mark - Compound Serializers + +- (void)testCompoundSerializerProperlySerializesResponse { + + AFImageResponseSerializer *imageSerializer = [AFImageResponseSerializer serializer]; + AFJSONResponseSerializer *jsonSerializer = [AFJSONResponseSerializer serializer]; + AFCompoundResponseSerializer *compoundSerializer = [AFCompoundResponseSerializer compoundSerializerWithResponseSerializers:@[imageSerializer, jsonSerializer]]; + + NSData *data = [NSJSONSerialization dataWithJSONObject:@{@"key":@"value"} options:0 error:nil]; + NSURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:[NSURL URLWithString:@"http://test.com"] + statusCode:200 + HTTPVersion:@"1.1" + headerFields:@{@"Content-Type":@"application/json"}]; + + NSError *error = nil; + id responseObject = [compoundSerializer responseObjectForResponse:response data:data error:&error]; + + XCTAssertTrue([responseObject isKindOfClass:[NSDictionary class]]); + XCTAssertNil(error); +} + +- (void)testCompoundSerializerCanBeCopied { + AFImageResponseSerializer *imageSerializer = [AFImageResponseSerializer serializer]; + AFJSONResponseSerializer *jsonSerializer = [AFJSONResponseSerializer serializer]; + AFCompoundResponseSerializer *compoundSerializer = [AFCompoundResponseSerializer compoundSerializerWithResponseSerializers:@[imageSerializer, jsonSerializer]]; + + AFCompoundResponseSerializer *copiedSerializer = [compoundSerializer copy]; + XCTAssertNotEqual(compoundSerializer, copiedSerializer); + XCTAssertTrue(compoundSerializer.responseSerializers.count == copiedSerializer.responseSerializers.count); + XCTAssertTrue([NSStringFromClass([[copiedSerializer.responseSerializers objectAtIndex:0] class]) isEqualToString:NSStringFromClass([AFImageResponseSerializer class])]); + XCTAssertTrue([NSStringFromClass([[copiedSerializer.responseSerializers objectAtIndex:1] class]) isEqualToString:NSStringFromClass([AFJSONResponseSerializer class])]); +} + +- (void)testCompoundSerializerCanBeArchivedAndUnarchived { + AFImageResponseSerializer *imageSerializer = [AFImageResponseSerializer serializer]; + AFJSONResponseSerializer *jsonSerializer = [AFJSONResponseSerializer serializer]; + AFCompoundResponseSerializer *compoundSerializer = [AFCompoundResponseSerializer compoundSerializerWithResponseSerializers:@[imageSerializer, jsonSerializer]]; + NSData *data = [NSKeyedArchiver archivedDataWithRootObject:compoundSerializer]; + XCTAssertNotNil(data); + AFCompoundResponseSerializer *unarchivedSerializer = [NSKeyedUnarchiver unarchiveObjectWithData:data]; + XCTAssertNotNil(unarchivedSerializer); + XCTAssertNotEqual(unarchivedSerializer, compoundSerializer); + XCTAssertTrue(compoundSerializer.responseSerializers.count == compoundSerializer.responseSerializers.count); + XCTAssertTrue([NSStringFromClass([[unarchivedSerializer.responseSerializers objectAtIndex:0] class]) isEqualToString:NSStringFromClass([AFImageResponseSerializer class])]); + XCTAssertTrue([NSStringFromClass([[unarchivedSerializer.responseSerializers objectAtIndex:1] class]) isEqualToString:NSStringFromClass([AFJSONResponseSerializer class])]); +} + +@end diff --git a/its/plugin/projects/AFNetworking/Tests/Tests/AFHTTPRequestSerializationTests.m b/its/plugin/projects/AFNetworking/Tests/Tests/AFHTTPRequestSerializationTests.m new file mode 100644 index 00000000..24ac1062 --- /dev/null +++ b/its/plugin/projects/AFNetworking/Tests/Tests/AFHTTPRequestSerializationTests.m @@ -0,0 +1,214 @@ +// AFHTTPRequestSerializationTests.m +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "AFTestCase.h" + +#import "AFURLRequestSerialization.h" + +@interface AFMultipartBodyStream : NSInputStream +@property (readwrite, nonatomic, strong) NSMutableArray *HTTPBodyParts; +@end + +@protocol AFMultipartFormDataTest +@property (readwrite, nonatomic, strong) AFMultipartBodyStream *bodyStream; + +- (instancetype)initWithURLRequest:(NSMutableURLRequest *)urlRequest + stringEncoding:(NSStringEncoding)encoding; +@end + +@interface AFHTTPBodyPart : NSObject +@property (nonatomic, assign) NSStringEncoding stringEncoding; +@property (nonatomic, strong) NSDictionary *headers; +@property (nonatomic, copy) NSString *boundary; +@property (nonatomic, strong) id body; +@property (nonatomic, assign) NSUInteger bodyContentLength; +@property (nonatomic, strong) NSInputStream *inputStream; +@property (nonatomic, assign) BOOL hasInitialBoundary; +@property (nonatomic, assign) BOOL hasFinalBoundary; +@property (readonly, nonatomic, assign, getter = hasBytesAvailable) BOOL bytesAvailable; +@property (readonly, nonatomic, assign) NSUInteger contentLength; + +- (NSInteger)read:(uint8_t *)buffer + maxLength:(NSUInteger)length; +@end + +#pragma mark - + +@interface AFHTTPRequestSerializationTests : AFTestCase +@property (nonatomic, strong) AFHTTPRequestSerializer *requestSerializer; +@end + +@implementation AFHTTPRequestSerializationTests + +- (void)setUp { + [super setUp]; + self.requestSerializer = [AFHTTPRequestSerializer serializer]; +} + +#pragma mark - + +- (void)testThatAFHTTPRequestSerializationSerializesPOSTRequestsProperly { + NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://example.com"]]; + request.HTTPMethod = @"POST"; + + NSURLRequest *serializedRequest = [self.requestSerializer requestBySerializingRequest:request withParameters:@{@"key":@"value"} error:nil]; + NSString *contentType = serializedRequest.allHTTPHeaderFields[@"Content-Type"]; + + XCTAssertNotNil(contentType); + XCTAssertEqualObjects(contentType, @"application/x-www-form-urlencoded"); + + XCTAssertNotNil(serializedRequest.HTTPBody); + XCTAssertEqualObjects(serializedRequest.HTTPBody, [@"key=value" dataUsingEncoding:NSUTF8StringEncoding]); +} + +- (void)testThatAFHTTPRequestSerializationSerializesPOSTRequestsProperlyWhenNoParameterIsProvided { + NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://example.com"]]; + request.HTTPMethod = @"POST"; + + NSURLRequest *serializedRequest = [self.requestSerializer requestBySerializingRequest:request withParameters:nil error:nil]; + NSString *contentType = serializedRequest.allHTTPHeaderFields[@"Content-Type"]; + + XCTAssertNotNil(contentType); + XCTAssertEqualObjects(contentType, @"application/x-www-form-urlencoded"); + + XCTAssertNotNil(serializedRequest.HTTPBody); + XCTAssertEqualObjects(serializedRequest.HTTPBody, [NSData data]); +} + +- (void)testThatAFHTTPRequestSerialiationSerializesQueryParametersCorrectly { + NSURLRequest *originalRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://example.com"]]; + NSURLRequest *serializedRequest = [self.requestSerializer requestBySerializingRequest:originalRequest withParameters:@{@"key":@"value"} error:nil]; + + XCTAssertTrue([[[serializedRequest URL] query] isEqualToString:@"key=value"], @"Query parameters have not been serialized correctly (%@)", [[serializedRequest URL] query]); +} + +- (void)testThatAFHTTPRequestSerialiationSerializesURLEncodableQueryParametersCorrectly { + NSURLRequest *originalRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://example.com"]]; + NSURLRequest *serializedRequest = [self.requestSerializer requestBySerializingRequest:originalRequest withParameters:@{@"key":@" :#[]@!$&'()*+,;=/?"} error:nil]; + + XCTAssertTrue([[[serializedRequest URL] query] isEqualToString:@"key=%20%3A%23%5B%5D%40%21%24%26%27%28%29%2A%2B%2C%3B%3D/?"], @"Query parameters have not been serialized correctly (%@)", [[serializedRequest URL] query]); +} + +- (void)testThatAFHTTPRequestSerialiationSerializesURLEncodedQueryParametersCorrectly { + NSURLRequest *originalRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://example.com"]]; + NSURLRequest *serializedRequest = [self.requestSerializer requestBySerializingRequest:originalRequest withParameters:@{@"key":@"%20%21%22%23%24%25%26%27%28%29%2A%2B%2C%2F"} error:nil]; + + XCTAssertTrue([[[serializedRequest URL] query] isEqualToString:@"key=%2520%2521%2522%2523%2524%2525%2526%2527%2528%2529%252A%252B%252C%252F"], @"Query parameters have not been serialized correctly (%@)", [[serializedRequest URL] query]); +} + +- (void)testThatAFHTTPRequestSerialiationSerializesQueryParametersCorrectlyFromQuerySerializationBlock { + [self.requestSerializer setQueryStringSerializationWithBlock:^NSString *(NSURLRequest *request, NSDictionary *parameters, NSError *__autoreleasing *error) { + __block NSMutableString *query = [NSMutableString stringWithString:@""]; + [parameters enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) { + [query appendFormat:@"%@**%@",key,obj]; + }]; + + return query; + }]; + + NSURLRequest *originalRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://example.com"]]; + NSURLRequest *serializedRequest = [self.requestSerializer requestBySerializingRequest:originalRequest withParameters:@{@"key":@"value"} error:nil]; + + XCTAssertTrue([[[serializedRequest URL] query] isEqualToString:@"key**value"], @"Custom Query parameters have not been serialized correctly (%@) by the query string block.", [[serializedRequest URL] query]); +} + +- (void)testThatAFHTTPRequestSerialiationSerializesMIMETypeCorrectly { + NSMutableURLRequest *originalRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://example.com"]]; + Class streamClass = NSClassFromString(@"AFStreamingMultipartFormData"); + id formData = [[streamClass alloc] initWithURLRequest:originalRequest stringEncoding:NSUTF8StringEncoding]; + + NSURL *fileURL = [NSURL fileURLWithPath:[[NSBundle bundleForClass:[self class]] pathForResource:@"ADNNetServerTrustChain/adn_0" ofType:@"cer"]]; + + [formData appendPartWithFileURL:fileURL name:@"test" error:NULL]; + + AFHTTPBodyPart *part = [formData.bodyStream.HTTPBodyParts firstObject]; + + XCTAssertTrue([part.headers[@"Content-Type"] isEqualToString:@"application/x-x509-ca-cert"], @"MIME Type has not been obtained correctly (%@)", part.headers[@"Content-Type"]); +} + +#pragma mark - + +- (void)testThatValueForHTTPHeaderFieldReturnsSetValue { + [self.requestSerializer setValue:@"Actual Value" forHTTPHeaderField:@"Set-Header"]; + NSString *value = [self.requestSerializer valueForHTTPHeaderField:@"Set-Header"]; + XCTAssertTrue([value isEqualToString:@"Actual Value"]); +} + +- (void)testThatValueForHTTPHeaderFieldReturnsNilForUnsetHeader { + NSString *value = [self.requestSerializer valueForHTTPHeaderField:@"Unset-Header"]; + XCTAssertNil(value); +} + +- (void)testQueryStringSerializationCanFailWithError { + AFHTTPRequestSerializer *serializer = [AFHTTPRequestSerializer serializer]; + + NSError *serializerError = [NSError errorWithDomain:@"TestDomain" code:0 userInfo:nil]; + + [serializer setQueryStringSerializationWithBlock:^NSString *(NSURLRequest *request, NSDictionary *parameters, NSError *__autoreleasing *error) { + *error = serializerError; + return nil; + }]; + + NSError *error; + NSURLRequest *request = [serializer requestWithMethod:@"GET" URLString:@"url" parameters:@{} error:&error]; + XCTAssertNil(request); + XCTAssertEqual(error, serializerError); +} + +- (void)testThatHTTPHeaderValueCanBeRemoved { + AFHTTPRequestSerializer *serializer = [AFHTTPRequestSerializer serializer]; + NSString *headerField = @"TestHeader"; + NSString *headerValue = @"test"; + [serializer setValue:headerValue forHTTPHeaderField:headerField]; + XCTAssertTrue([serializer.HTTPRequestHeaders[headerField] isEqualToString:headerValue]); + [serializer setValue:nil forHTTPHeaderField:headerField]; + XCTAssertFalse([serializer.HTTPRequestHeaders.allKeys containsObject:headerField]); +} + +#pragma mark - Helper Methods + +- (void)testQueryStringFromParameters { + XCTAssertTrue([AFQueryStringFromParameters(@{@"key":@"value",@"key1":@"value&"}) isEqualToString:@"key=value&key1=value%26"]); +} + +- (void)testPercentEscapingString { + XCTAssertTrue([AFPercentEscapedStringFromString(@":#[]@!$&'()*+,;=?/") isEqualToString:@"%3A%23%5B%5D%40%21%24%26%27%28%29%2A%2B%2C%3B%3D?/"]); +} + +#pragma mark - #3028 tests +//https://github.com/AFNetworking/AFNetworking/pull/3028 + +- (void)testThatEmojiIsProperlyEncoded { + //Start with an odd number of characters so we can cross the 50 character boundry + NSMutableString *parameter = [NSMutableString stringWithString:@"!"]; + while (parameter.length < 50) { + [parameter appendString:@"👴🏿👷🏻👮🏽"]; + } + + AFHTTPRequestSerializer *serializer = [AFHTTPRequestSerializer serializer]; + NSURLRequest *request = [serializer requestWithMethod:@"GET" + URLString:@"http://test.com" + parameters:@{@"test":parameter} + error:nil]; + XCTAssertTrue([request.URL.query isEqualToString:@"test=%21%F0%9F%91%B4%F0%9F%8F%BF%F0%9F%91%B7%F0%9F%8F%BB%F0%9F%91%AE%F0%9F%8F%BD%F0%9F%91%B4%F0%9F%8F%BF%F0%9F%91%B7%F0%9F%8F%BB%F0%9F%91%AE%F0%9F%8F%BD%F0%9F%91%B4%F0%9F%8F%BF%F0%9F%91%B7%F0%9F%8F%BB%F0%9F%91%AE%F0%9F%8F%BD%F0%9F%91%B4%F0%9F%8F%BF%F0%9F%91%B7%F0%9F%8F%BB%F0%9F%91%AE%F0%9F%8F%BD%F0%9F%91%B4%F0%9F%8F%BF%F0%9F%91%B7%F0%9F%8F%BB%F0%9F%91%AE%F0%9F%8F%BD"]); +} + +@end diff --git a/its/plugin/projects/AFNetworking/Tests/Tests/AFHTTPResponseSerializationTests.m b/its/plugin/projects/AFNetworking/Tests/Tests/AFHTTPResponseSerializationTests.m new file mode 100644 index 00000000..8e0f2cac --- /dev/null +++ b/its/plugin/projects/AFNetworking/Tests/Tests/AFHTTPResponseSerializationTests.m @@ -0,0 +1,89 @@ +// AFHTTPResponseSerializationTests.m +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "AFTestCase.h" + +#import "AFURLResponseSerialization.h" + +@interface AFHTTPResponseSerializationTests : AFTestCase +@property (nonatomic, strong) AFHTTPResponseSerializer *responseSerializer; +@end + +@implementation AFHTTPResponseSerializationTests + +- (void)setUp { + [super setUp]; + self.responseSerializer = [AFHTTPResponseSerializer serializer]; +} + +#pragma mark - + +- (void)testThatAFHTTPResponseSerializationHandlesAll2XXCodes { + NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(200, 100)]; + [indexSet enumerateIndexesUsingBlock:^(NSUInteger statusCode, BOOL *stop) { + NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:self.baseURL statusCode:statusCode HTTPVersion:@"1.1" headerFields:@{@"Content-Type": @"text/html"}]; + + XCTAssert([self.responseSerializer.acceptableStatusCodes containsIndex:statusCode], @"Status code %@ should be acceptable", @(statusCode)); + + NSError *error = nil; + [self.responseSerializer validateResponse:response data:[@"text" dataUsingEncoding:NSUTF8StringEncoding] error:&error]; + + XCTAssertNil(error, @"Error handling status code %@", @(statusCode)); + }]; +} + +- (void)testThatAFHTTPResponseSerializationFailsAll4XX5XXStatusCodes { + NSIndexSet *indexSet = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(400, 200)]; + [indexSet enumerateIndexesUsingBlock:^(NSUInteger statusCode, BOOL *stop) { + NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:self.baseURL statusCode:statusCode HTTPVersion:@"1.1" headerFields:@{@"Content-Type": @"text/html"}]; + + XCTAssert(![self.responseSerializer.acceptableStatusCodes containsIndex:statusCode], @"Status code %@ should not be acceptable", @(statusCode)); + + NSError *error = nil; + [self.responseSerializer validateResponse:response data:[@"text" dataUsingEncoding:NSUTF8StringEncoding] error:&error]; + + XCTAssertNotNil(error, @"Did not fail handling status code %@",@(statusCode)); + }]; +} + +- (void)testResponseIsValidated { + NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:[NSURL URLWithString:@"http://test.com"] + statusCode:200 + HTTPVersion:@"1.1" + headerFields:@{@"Content-Type":@"text/html"}]; + NSData *data = [@"text" dataUsingEncoding:NSUTF8StringEncoding]; + NSError *error = nil; + XCTAssertTrue([self.responseSerializer validateResponse:response data:data error:&error]); +} + +- (void)testCanBeCopied { + AFHTTPResponseSerializer *copiedSerializer = [self.responseSerializer copy]; + XCTAssertNotNil(copiedSerializer); + XCTAssertNotEqual(copiedSerializer, self.responseSerializer); + XCTAssertTrue(copiedSerializer.acceptableContentTypes.count == self.responseSerializer.acceptableContentTypes.count); + XCTAssertTrue(copiedSerializer.acceptableStatusCodes.count == self.responseSerializer.acceptableStatusCodes.count); +} + +- (void)testSupportsSecureCoding { + XCTAssertTrue([AFHTTPResponseSerializer supportsSecureCoding]); +} + +@end diff --git a/its/plugin/projects/AFNetworking/Tests/Tests/AFHTTPSessionManagerTests.m b/its/plugin/projects/AFNetworking/Tests/Tests/AFHTTPSessionManagerTests.m new file mode 100644 index 00000000..7615c822 --- /dev/null +++ b/its/plugin/projects/AFNetworking/Tests/Tests/AFHTTPSessionManagerTests.m @@ -0,0 +1,538 @@ +// AFHTTPSessionManagerTests.m +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "AFTestCase.h" + +#import "AFHTTPSessionManager.h" +#import "AFSecurityPolicy.h" + +@interface AFHTTPSessionManagerTests : AFTestCase +@property (readwrite, nonatomic, strong) AFHTTPSessionManager *manager; +@end + +@implementation AFHTTPSessionManagerTests + +- (void)setUp { + [super setUp]; + self.manager = [[AFHTTPSessionManager alloc] initWithBaseURL:self.baseURL]; +} + +- (void)tearDown { + [self.manager invalidateSessionCancelingTasks:YES]; + [super tearDown]; +} + +#pragma mark - init +- (void)testSharedManagerIsNotEqualToInitdManager { + XCTAssertFalse([[AFHTTPSessionManager manager] isEqual:self.manager]); +} + +#pragma mark - misc + +- (void)testThatOperationInvokesCompletionHandlerWithResponseObjectOnSuccess { + __block id blockResponseObject = nil; + __block id blockError = nil; + + XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"]; + + NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"/get" relativeToURL:self.baseURL]]; + NSURLSessionDataTask *task = [self.manager dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) { + blockResponseObject = responseObject; + blockError = error; + [expectation fulfill]; + }]; + + [task resume]; + + [self waitForExpectationsWithTimeout:10.0 handler:nil]; + + XCTAssertTrue(task.state == NSURLSessionTaskStateCompleted); + XCTAssertNil(blockError); + XCTAssertNotNil(blockResponseObject); +} + +- (void)testThatOperationInvokesFailureCompletionBlockWithErrorOnFailure { + __block id blockError = nil; + + XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"]; + + NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"/status/404" relativeToURL:self.baseURL]]; + NSURLSessionDataTask *task = [self.manager dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) { + blockError = error; + [expectation fulfill]; + }]; + + [task resume]; + + [self waitForExpectationsWithTimeout:10.0 handler:nil]; + + XCTAssertTrue(task.state == NSURLSessionTaskStateCompleted); + XCTAssertNotNil(blockError); +} + +- (void)testThatRedirectBlockIsCalledWhen302IsEncountered { + __block BOOL success; + __block NSError *blockError = nil; + + XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"]; + + NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"/redirect/1" relativeToURL:self.baseURL]]; + NSURLSessionDataTask *task = [self.manager dataTaskWithRequest:request completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) { + blockError = error; + [expectation fulfill]; + }]; + + [self.manager setTaskWillPerformHTTPRedirectionBlock:^NSURLRequest *(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request) { + if (response) { + success = YES; + } + + return request; + }]; + + [task resume]; + + [self waitForExpectationsWithTimeout:10.0 handler:nil]; + + XCTAssertTrue(task.state == NSURLSessionTaskStateCompleted); + XCTAssertNil(blockError); + XCTAssertTrue(success); +} + +- (void)testDownloadFileCompletionSpecifiesURLInCompletionWithManagerDidFinishBlock { + __block BOOL managerDownloadFinishedBlockExecuted = NO; + __block BOOL completionBlockExecuted = NO; + __block NSURL *downloadFilePath = nil; + XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"]; + + [self.manager setDownloadTaskDidFinishDownloadingBlock:^NSURL *(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location) { + managerDownloadFinishedBlockExecuted = YES; + NSURL *dirURL = [[[NSFileManager defaultManager] URLsForDirectory:NSLibraryDirectory inDomains:NSUserDomainMask] lastObject]; + return [dirURL URLByAppendingPathComponent:@"t1.file"]; + }]; + + NSURLSessionDownloadTask *downloadTask; + downloadTask = [self.manager + downloadTaskWithRequest:[NSURLRequest requestWithURL:self.baseURL] + progress:nil + destination:nil + completionHandler:^(NSURLResponse *response, NSURL *filePath, NSError *error) { + downloadFilePath = filePath; + completionBlockExecuted = YES; + [expectation fulfill]; + }]; + [downloadTask resume]; + [self waitForExpectationsWithTimeout:10.0 handler:nil]; + XCTAssertTrue(completionBlockExecuted); + XCTAssertTrue(managerDownloadFinishedBlockExecuted); + XCTAssertNotNil(downloadFilePath); +} + +- (void)testDownloadFileCompletionSpecifiesURLInCompletionBlock { + __block BOOL destinationBlockExecuted = NO; + __block BOOL completionBlockExecuted = NO; + __block NSURL *downloadFilePath = nil; + XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"]; + + NSURLSessionDownloadTask *downloadTask = [self.manager downloadTaskWithRequest:[NSURLRequest requestWithURL:self.baseURL] + progress:nil + destination:^NSURL *(NSURL *targetPath, NSURLResponse *response) { + destinationBlockExecuted = YES; + NSURL *dirURL = [[[NSFileManager defaultManager] URLsForDirectory:NSLibraryDirectory inDomains:NSUserDomainMask] lastObject]; + return [dirURL URLByAppendingPathComponent:@"t1.file"]; + } + completionHandler:^(NSURLResponse *response, NSURL *filePath, NSError *error) { + downloadFilePath = filePath; + completionBlockExecuted = YES; + [expectation fulfill]; + }]; + [downloadTask resume]; + [self waitForExpectationsWithTimeout:10.0 handler:nil]; + XCTAssertTrue(completionBlockExecuted); + XCTAssertTrue(destinationBlockExecuted); + XCTAssertNotNil(downloadFilePath); +} + +- (void)testThatSerializationErrorGeneratesErrorAndNullTaskForGET { + XCTestExpectation *expectation = [self expectationWithDescription:@"Serialization should fail"]; + + [self.manager.requestSerializer setQueryStringSerializationWithBlock:^NSString * _Nonnull(NSURLRequest * _Nonnull request, id _Nonnull parameters, NSError * _Nullable __autoreleasing * _Nullable error) { + *error = [NSError errorWithDomain:@"Custom" code:-1 userInfo:nil]; + return @""; + }]; + + NSURLSessionTask *nilTask; + nilTask = [self.manager + GET:@"test" + parameters:@{@"key":@"value"} + progress:nil + success:nil + failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { + XCTAssertNil(task); + [expectation fulfill]; + }]; + XCTAssertNil(nilTask); + [self waitForExpectationsWithTimeout:10.0 handler:nil]; +} + +#pragma mark - NSCoding + +- (void)testSupportsSecureCoding { + XCTAssertTrue([AFHTTPSessionManager supportsSecureCoding]); +} + +- (void)testCanBeEncoded { + NSData *data = [NSKeyedArchiver archivedDataWithRootObject:self.manager]; + XCTAssertNotNil(data); +} + +- (void)testCanBeDecoded { + NSData *data = [NSKeyedArchiver archivedDataWithRootObject:self.manager]; + AFHTTPSessionManager *newManager = [NSKeyedUnarchiver unarchiveObjectWithData:data]; + XCTAssertNotNil(newManager.securityPolicy); + XCTAssertNotNil(newManager.requestSerializer); + XCTAssertNotNil(newManager.responseSerializer); + XCTAssertNotNil(newManager.baseURL); + XCTAssertNotNil(newManager.session); + XCTAssertNotNil(newManager.session.configuration); +} + +#pragma mark - NSCopying + +- (void)testCanBeCopied { + AFHTTPSessionManager *copyManager = [self.manager copy]; + XCTAssertNotNil(copyManager); +} + +#pragma mark - Progress + +- (void)testDownloadProgressIsReportedForGET { + XCTestExpectation *expectation = [self expectationWithDescription:@"Progress Should equal 1.0"]; + [self.manager + GET:@"image" + parameters:nil + progress:^(NSProgress * _Nonnull downloadProgress) { + if (downloadProgress.fractionCompleted == 1.0) { + [expectation fulfill]; + } + } + success:nil + failure:nil]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +- (void)testUploadProgressIsReportedForPOST { + NSMutableString *payload = [NSMutableString stringWithString:@"AFNetworking"]; + while ([payload lengthOfBytesUsingEncoding:NSUTF8StringEncoding] < 20000) { + [payload appendString:@"AFNetworking"]; + } + + __weak __block XCTestExpectation *expectation = [self expectationWithDescription:@"Progress Should equal 1.0"]; + + [self.manager + POST:@"post" + parameters:payload + progress:^(NSProgress * _Nonnull uploadProgress) { + if (uploadProgress.fractionCompleted == 1.0) { + [expectation fulfill]; + expectation = nil; + } + } + success:nil + failure:nil]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +- (void)testUploadProgressIsReportedForStreamingPost { + NSMutableString *payload = [NSMutableString stringWithString:@"AFNetworking"]; + while ([payload lengthOfBytesUsingEncoding:NSUTF8StringEncoding] < 20000) { + [payload appendString:@"AFNetworking"]; + } + + __block __weak XCTestExpectation *expectation = [self expectationWithDescription:@"Progress Should equal 1.0"]; + + [self.manager + POST:@"post" + parameters:nil + constructingBodyWithBlock:^(id _Nonnull formData) { + [formData appendPartWithFileData:[payload dataUsingEncoding:NSUTF8StringEncoding] name:@"AFNetworking" fileName:@"AFNetworking" mimeType:@"text/html"]; + } + progress:^(NSProgress * _Nonnull uploadProgress) { + if (uploadProgress.fractionCompleted == 1.0) { + [expectation fulfill]; + expectation = nil; + } + } + success:nil + failure:nil]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +# pragma mark - HTTP Status Codes + +- (void)testThatSuccessBlockIsCalledFor200 { + XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"]; + [self.manager + GET:@"status/200" + parameters:nil + progress:nil + success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + [expectation fulfill]; + } + failure:nil]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +- (void)testThatFailureBlockIsCalledFor404 { + XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"]; + [self.manager + GET:@"status/404" + parameters:nil + progress:nil + success:nil + failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nullable error) { + [expectation fulfill]; + }]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +- (void)testThatResponseObjectIsEmptyFor204 { + __block id urlResponseObject = nil; + XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"]; + [self.manager + GET:@"status/204" + parameters:nil + progress:nil + success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + urlResponseObject = responseObject; + [expectation fulfill]; + } + failure:nil]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + XCTAssertNil(urlResponseObject); +} + +#pragma mark - Rest Interface + +- (void)testGET { + XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"]; + [self.manager + GET:@"get" + parameters:nil + progress:nil + success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + XCTAssertNotNil(responseObject); + [expectation fulfill]; + } + failure:nil]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +- (void)testHEAD { + XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"]; + [self.manager + HEAD:@"get" + parameters:nil + success:^(NSURLSessionDataTask * _Nonnull task) { + XCTAssertNotNil(task); + [expectation fulfill]; + } + failure:nil]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +- (void)testPOST { + XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"]; + [self.manager + POST:@"post" + parameters:@{@"key":@"value"} + progress:nil + success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + XCTAssertTrue([responseObject[@"form"][@"key"] isEqualToString:@"value"]); + [expectation fulfill]; + } + failure:nil]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +- (void)testPOSTWithConstructingBody { + XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"]; + [self.manager + POST:@"post" + parameters:@{@"key":@"value"} + constructingBodyWithBlock:^(id _Nonnull formData) { + [formData appendPartWithFileData:[@"Data" dataUsingEncoding:NSUTF8StringEncoding] + name:@"DataName" + fileName:@"DataFileName" + mimeType:@"data"]; + } + progress:nil + success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + XCTAssertTrue([responseObject[@"files"][@"DataName"] isEqualToString:@"Data"]); + XCTAssertTrue([responseObject[@"form"][@"key"] isEqualToString:@"value"]); + [expectation fulfill]; + } + failure:nil]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +- (void)testPUT { + XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"]; + [self.manager + PUT:@"put" + parameters:@{@"key":@"value"} + success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + XCTAssertTrue([responseObject[@"form"][@"key"] isEqualToString:@"value"]); + [expectation fulfill]; + } + failure:nil]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +- (void)testDELETE { + XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"]; + [self.manager + DELETE:@"delete" + parameters:@{@"key":@"value"} + success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + XCTAssertTrue([responseObject[@"args"][@"key"] isEqualToString:@"value"]); + [expectation fulfill]; + } + failure:nil]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +- (void)testPATCH { + XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"]; + [self.manager + PATCH:@"patch" + parameters:@{@"key":@"value"} + success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + XCTAssertTrue([responseObject[@"form"][@"key"] isEqualToString:@"value"]); + [expectation fulfill]; + } + failure:nil]; + + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +#pragma mark - Deprecated Rest Interface + +- (void)testDeprecatedGET { + XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"]; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + [self.manager + GET:@"get" + parameters:nil + success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + XCTAssertNotNil(responseObject); + [expectation fulfill]; + } + failure:nil]; +#pragma clang diagnostic pop + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +- (void)testDeprecatedPOST { + XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"]; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + [self.manager + POST:@"post" + parameters:@{@"key":@"value"} + success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + XCTAssertTrue([responseObject[@"form"][@"key"] isEqualToString:@"value"]); + [expectation fulfill]; + } + failure:nil]; +#pragma clang diagnostic pop + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +- (void)testDeprecatedPOSTWithConstructingBody { + XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"]; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" + [self.manager + POST:@"post" + parameters:@{@"key":@"value"} + constructingBodyWithBlock:^(id _Nonnull formData) { + [formData appendPartWithFileData:[@"Data" dataUsingEncoding:NSUTF8StringEncoding] + name:@"DataName" + fileName:@"DataFileName" + mimeType:@"data"]; + } + success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + XCTAssertTrue([responseObject[@"files"][@"DataName"] isEqualToString:@"Data"]); + XCTAssertTrue([responseObject[@"form"][@"key"] isEqualToString:@"value"]); + [expectation fulfill]; + } + failure:nil]; +#pragma clang diagnostic pop + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +#pragma mark - Auth + +- (void)testHiddenBasicAuthentication { + __weak XCTestExpectation *expectation = [self expectationWithDescription:@"Request should finish"]; + [self.manager.requestSerializer setAuthorizationHeaderFieldWithUsername:@"user" password:@"password"]; + [self.manager + GET:@"hidden-basic-auth/user/password" + parameters:nil + progress:nil + success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + [expectation fulfill]; + } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { + XCTFail(@"Request should succeed"); + [expectation fulfill]; + }]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +# pragma mark - Server Trust + +- (void)testInvalidServerTrustProducesCorrectError { + __weak XCTestExpectation *expectation = [self expectationWithDescription:@"Request should fail"]; + NSURL *googleCertificateURL = [[NSBundle bundleForClass:[self class]] URLForResource:@"google.com" withExtension:@"cer"]; + NSData *googleCertificateData = [NSData dataWithContentsOfURL:googleCertificateURL]; + AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] initWithBaseURL:[NSURL URLWithString:@"https://apple.com/"]]; + [manager setResponseSerializer:[AFHTTPResponseSerializer serializer]]; + manager.securityPolicy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate withPinnedCertificates:[NSSet setWithObject:googleCertificateData]]; + [manager + GET:@"AFNetworking/AFNetworking" + parameters:nil + progress:nil + success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { + XCTFail(@"Request should fail"); + [expectation fulfill]; + } + failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { + XCTAssertEqualObjects(error.domain, NSURLErrorDomain); + XCTAssertEqual(error.code, NSURLErrorServerCertificateUntrusted); + [expectation fulfill]; + }]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + [manager invalidateSessionCancelingTasks:YES]; +} + +@end diff --git a/its/plugin/projects/AFNetworking/Tests/Tests/AFImageDownloaderTests.m b/its/plugin/projects/AFNetworking/Tests/Tests/AFImageDownloaderTests.m new file mode 100644 index 00000000..ac112f6e --- /dev/null +++ b/its/plugin/projects/AFNetworking/Tests/Tests/AFImageDownloaderTests.m @@ -0,0 +1,428 @@ +// AFImageDownloaderTests.m +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "AFTestCase.h" +#import "AFImageDownloader.h" + +@interface AFImageDownloaderTests : AFTestCase +@property (nonatomic, strong) NSURLRequest *pngRequest; +@property (nonatomic, strong) NSURLRequest *jpegRequest; +@property (nonatomic, strong) AFImageDownloader *downloader; +@end + +@implementation AFImageDownloaderTests + +- (void)setUp { + [super setUp]; + self.downloader = [[AFImageDownloader alloc] init]; + [[AFImageDownloader defaultURLCache] removeAllCachedResponses]; + [[[AFImageDownloader defaultInstance] imageCache] removeAllImages]; + NSURL *pngURL = [NSURL URLWithString:@"https://httpbin.org/image/png"]; + self.pngRequest = [NSURLRequest requestWithURL:pngURL]; + NSURL *jpegURL = [NSURL URLWithString:@"https://httpbin.org/image/jpeg"]; + self.jpegRequest = [NSURLRequest requestWithURL:jpegURL]; +} + +- (void)tearDown { + [self.downloader.sessionManager invalidateSessionCancelingTasks:YES]; + self.downloader = nil; + // Put teardown code here. This method is called after the invocation of each test method in the class. + [super tearDown]; + self.pngRequest = nil; +} + +#pragma mark - Image Download + +- (void)testThatImageDownloaderSingletonCanBeInitialized { + AFImageDownloader *downloader = [AFImageDownloader defaultInstance]; + XCTAssertNotNil(downloader, @"Downloader should not be nil"); +} + +- (void)testThatImageDownloaderCanBeInitializedAndDeinitializedWithActiveDownloads { + [self.downloader downloadImageForURLRequest:self.pngRequest + success:nil + failure:nil]; + self.downloader = nil; + XCTAssertNil(self.downloader, @"Downloader should be nil"); +} + +- (void)testThatImageDownloaderCanDownloadImage { + XCTestExpectation *expectation = [self expectationWithDescription:@"image download should succeed"]; + + __block NSHTTPURLResponse *urlResponse = nil; + __block UIImage *responseImage = nil; + + [self.downloader + downloadImageForURLRequest:self.pngRequest + success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) { + urlResponse = response; + responseImage = responseObject; + [expectation fulfill]; + } + failure:nil]; + + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + + XCTAssertNotNil(urlResponse, @"HTTPURLResponse should not be nil"); + XCTAssertNotNil(responseImage, @"Response image should not be nil"); +} + +- (void)testThatItCanDownloadMultipleImagesSimultaneously { + XCTestExpectation *expectation1 = [self expectationWithDescription:@"image 1 download should succeed"]; + __block NSHTTPURLResponse *urlResponse1 = nil; + __block UIImage *responseImage1 = nil; + + [self.downloader + downloadImageForURLRequest:self.pngRequest + success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) { + urlResponse1 = response; + responseImage1 = responseObject; + [expectation1 fulfill]; + } + failure:nil]; + + XCTestExpectation *expectation2 = [self expectationWithDescription:@"image 2 download should succeed"]; + __block NSHTTPURLResponse *urlResponse2 = nil; + __block UIImage *responseImage2 = nil; + + [self.downloader + downloadImageForURLRequest:self.jpegRequest + success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) { + urlResponse2 = response; + responseImage2 = responseObject; + [expectation2 fulfill]; + } + failure:nil]; + + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + + XCTAssertNotNil(urlResponse1, @"HTTPURLResponse should not be nil"); + XCTAssertNotNil(responseImage1, @"Respone image should not be nil"); + + XCTAssertNotNil(urlResponse2, @"HTTPURLResponse should not be nil"); + XCTAssertNotNil(responseImage2, @"Respone image should not be nil"); +} + +- (void)testThatSimultaneouslyRequestsForTheSameAssetReceiveSameResponse { + XCTestExpectation *expectation1 = [self expectationWithDescription:@"image 1 download should succeed"]; + __block NSHTTPURLResponse *urlResponse1 = nil; + __block UIImage *responseImage1 = nil; + + [self.downloader + downloadImageForURLRequest:self.pngRequest + success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) { + urlResponse1 = response; + responseImage1 = responseObject; + [expectation1 fulfill]; + } + failure:nil]; + + XCTestExpectation *expectation2 = [self expectationWithDescription:@"image 2 download should succeed"]; + __block NSHTTPURLResponse *urlResponse2 = nil; + __block UIImage *responseImage2 = nil; + + [self.downloader + downloadImageForURLRequest:self.pngRequest + success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) { + urlResponse2 = response; + responseImage2 = responseObject; + [expectation2 fulfill]; + } + failure:nil]; + + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + + XCTAssertEqual(urlResponse1, urlResponse2, @"responses should be equal"); + XCTAssertEqual(responseImage2, responseImage2, @"responses should be equal"); +} + +- (void)testThatImageBehindRedirectCanBeDownloaded { + XCTestExpectation *expectation = [self expectationWithDescription:@"image download should succeed"]; + NSURL *redirectURL = [self.jpegRequest URL]; + NSURLRequest *request = [NSURLRequest requestWithURL:redirectURL]; + + __block NSHTTPURLResponse *urlResponse = nil; + __block UIImage *responseImage = nil; + + [self.downloader + downloadImageForURLRequest:request + success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) { + urlResponse = response; + responseImage = responseObject; + [expectation fulfill]; + } + failure:nil]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + XCTAssertNotNil(urlResponse); + XCTAssertNotNil(responseImage); + +} + +#pragma mark - Caching +- (void)testThatResponseIsNilWhenReturnedFromCache { + XCTestExpectation *expectation1 = [self expectationWithDescription:@"image 1 download should succeed"]; + __block NSHTTPURLResponse *urlResponse1 = nil; + __block UIImage *responseImage1 = nil; + + [self.downloader + downloadImageForURLRequest:self.pngRequest + success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) { + urlResponse1 = response; + responseImage1 = responseObject; + [expectation1 fulfill]; + } + failure:nil]; + + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + + XCTestExpectation *expectation2 = [self expectationWithDescription:@"image 2 download should succeed"]; + __block NSHTTPURLResponse *urlResponse2 = nil; + __block UIImage *responseImage2 = nil; + + [self.downloader + downloadImageForURLRequest:self.pngRequest + success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) { + urlResponse2 = response; + responseImage2 = responseObject; + [expectation2 fulfill]; + } + failure:nil]; + + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + + XCTAssertNotNil(urlResponse1); + XCTAssertNotNil(responseImage1); + XCTAssertNil(urlResponse2); + XCTAssertEqual(responseImage1, responseImage2); +} + +- (void)testThatImageDownloadReceiptIsNilForCachedImage { + XCTestExpectation *expectation1 = [self expectationWithDescription:@"image 1 download should succeed"]; + AFImageDownloadReceipt *receipt1; + receipt1 = [self.downloader + downloadImageForURLRequest:self.pngRequest + success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) { + [expectation1 fulfill]; + } + failure:nil]; + + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + + XCTestExpectation *expectation2 = [self expectationWithDescription:@"image 2 download should succeed"]; + + AFImageDownloadReceipt *receipt2; + receipt2 = [self.downloader + downloadImageForURLRequest:self.pngRequest + success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) { + [expectation2 fulfill]; + } + failure:nil]; + + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + + XCTAssertNotNil(receipt1); + XCTAssertNil(receipt2); +} + +- (void)testThatCacheIsIgnoredIfCacheIgnoredInRequest { + XCTestExpectation *expectation1 = [self expectationWithDescription:@"image 1 download should succeed"]; + + __block NSHTTPURLResponse *urlResponse1 = nil; + __block UIImage *responseImage1 = nil; + AFImageDownloadReceipt *receipt1; + receipt1 = [self.downloader + downloadImageForURLRequest:self.pngRequest + success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) { + urlResponse1 = response; + responseImage1 = responseObject; + [expectation1 fulfill]; + } + failure:nil]; + + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + + XCTestExpectation *expectation2 = [self expectationWithDescription:@"image 2 download should succeed"]; + NSMutableURLRequest *alteredRequest = [self.pngRequest mutableCopy]; + alteredRequest.cachePolicy = NSURLRequestReloadIgnoringLocalCacheData; + + AFImageDownloadReceipt *receipt2; + __block NSHTTPURLResponse *urlResponse2 = nil; + __block UIImage *responseImage2 = nil; + receipt2 = [self.downloader + downloadImageForURLRequest:alteredRequest + success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) { + urlResponse2 = response; + responseImage2 = responseObject; + [expectation2 fulfill]; + } + failure:nil]; + + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + + XCTAssertNotNil(receipt1); + XCTAssertNotNil(receipt2); + XCTAssertNotEqual(receipt1, receipt2); + + XCTAssertNotNil(urlResponse1); + XCTAssertNotNil(responseImage1); + + XCTAssertNotNil(urlResponse2); + XCTAssertNotNil(responseImage2); + + XCTAssertNotEqual(responseImage1, responseImage2); +} + +#pragma mark - Cancellation + +- (void)testThatCancellingDownloadCallsCompletionWithCancellationError { + AFImageDownloadReceipt *receipt; + XCTestExpectation *expectation = [self expectationWithDescription:@"image download should fail"]; + __block NSError *responseError = nil; + receipt = [self.downloader + downloadImageForURLRequest:self.pngRequest + success:nil + failure:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, NSError * _Nonnull error) { + responseError = error; + [expectation fulfill]; + }]; + [self.downloader cancelTaskForImageDownloadReceipt:receipt]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + + XCTAssertTrue(responseError.code == NSURLErrorCancelled); + XCTAssertTrue([responseError.domain isEqualToString:NSURLErrorDomain]); +} + +- (void)testThatCancellingDownloadWithMultipleResponseHandlersCancelsFirstYetAllowsSecondToComplete { + XCTestExpectation *expectation1 = [self expectationWithDescription:@"image 1 download should succeed"]; + __block NSHTTPURLResponse *urlResponse = nil; + __block UIImage *responseImage = nil; + + [self.downloader + downloadImageForURLRequest:self.pngRequest + success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) { + urlResponse = response; + responseImage = responseObject; + [expectation1 fulfill]; + } + failure:nil]; + + XCTestExpectation *expectation2 = [self expectationWithDescription:@"image 2 download should fail"]; + __block NSError *responseError = nil; + AFImageDownloadReceipt *receipt; + receipt = [self.downloader + downloadImageForURLRequest:self.pngRequest + success:nil + failure:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, NSError * _Nonnull error) { + responseError = error; + [expectation2 fulfill]; + }]; + [self.downloader cancelTaskForImageDownloadReceipt:receipt]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + + XCTAssertTrue(responseError.code == NSURLErrorCancelled); + XCTAssertTrue([responseError.domain isEqualToString:NSURLErrorDomain]); + XCTAssertNotNil(urlResponse); + XCTAssertNotNil(responseImage); +} + +- (void)testThatItCanDownloadAndCancelAndDownloadAgain { + NSArray *imageURLStrings = @[ + @"https://secure.gravatar.com/avatar/5a105e8b9d40e1329780d62ea2265d8a?d=identicon", + @"https://secure.gravatar.com/avatar/6a105e8b9d40e1329780d62ea2265d8a?d=identicon", + @"https://secure.gravatar.com/avatar/7a105e8b9d40e1329780d62ea2265d8a?d=identicon", + @"https://secure.gravatar.com/avatar/8a105e8b9d40e1329780d62ea2265d8a?d=identicon", + @"https://secure.gravatar.com/avatar/9a105e8b9d40e1329780d62ea2265d8a?d=identicon" + ]; + + for (NSString *imageURLString in imageURLStrings) { + XCTestExpectation *expectation = [self expectationWithDescription:[NSString stringWithFormat:@"Request %@ should be cancelled", imageURLString]]; + AFImageDownloadReceipt *receipt = [self.downloader + downloadImageForURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:imageURLString]] + success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) { + XCTFail(@"Request %@ succeeded when it should have failed", request); + } + failure:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, NSError * _Nonnull error) { + XCTAssertTrue([error.domain isEqualToString:NSURLErrorDomain]); + XCTAssertTrue([error code] == NSURLErrorCancelled); + [expectation fulfill]; + }]; + [self.downloader cancelTaskForImageDownloadReceipt:receipt]; + } + + for (NSString *imageURLString in imageURLStrings) { + XCTestExpectation *expectation = [self expectationWithDescription:[NSString stringWithFormat:@"Request %@ should succeed", imageURLString]]; + [self.downloader + downloadImageForURLRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:imageURLString]] + success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) { + [expectation fulfill]; + } failure:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, NSError * _Nonnull error) { + XCTFail(@"Request %@ failed with error %@", request, error); + }]; + } + + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +#pragma mark - Threading +- (void)testThatItAlwaysCallsTheSuccessHandlerOnTheMainQueue { + XCTestExpectation *expectation = [self expectationWithDescription:@"image download should succeed"]; + __block BOOL successIsOnMainThread = false; + [self.downloader + downloadImageForURLRequest:self.pngRequest + success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) { + successIsOnMainThread = [[NSThread currentThread] isMainThread]; + [expectation fulfill]; + } + failure:nil]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + XCTAssertTrue(successIsOnMainThread); +} + +- (void)testThatItAlwaysCallsTheFailureHandlerOnTheMainQueue { + NSURL *url = [NSURL URLWithString:@"https://httpbin.org/status/404"]; + NSURLRequest *request = [NSURLRequest requestWithURL:url]; + XCTestExpectation *expectation = [self expectationWithDescription:@"image download should fail"]; + __block BOOL failureIsOnMainThread = false; + [self.downloader + downloadImageForURLRequest:request + success:nil + failure:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, NSError * _Nonnull error) { + failureIsOnMainThread = [[NSThread currentThread] isMainThread]; + [expectation fulfill]; + }]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + XCTAssertTrue(failureIsOnMainThread); +} + +#pragma mark - misc + +- (void)testThatReceiptIDMatchesReturnedID { + NSUUID *receiptId = [NSUUID UUID]; + AFImageDownloadReceipt *receipt = [self.downloader + downloadImageForURLRequest:self.jpegRequest + withReceiptID:receiptId + success:nil + failure:nil]; + XCTAssertEqual(receiptId, receipt.receiptID); + [self.downloader cancelTaskForImageDownloadReceipt:receipt]; +} + +@end diff --git a/its/plugin/projects/AFNetworking/Tests/Tests/AFJSONSerializationTests.m b/its/plugin/projects/AFNetworking/Tests/Tests/AFJSONSerializationTests.m new file mode 100644 index 00000000..1ce27fba --- /dev/null +++ b/its/plugin/projects/AFNetworking/Tests/Tests/AFJSONSerializationTests.m @@ -0,0 +1,171 @@ +// AFJSONSerializationTests.m +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "AFTestCase.h" + +#import "AFURLRequestSerialization.h" +#import "AFURLResponseSerialization.h" + +static NSData * AFJSONTestData() { + return [NSJSONSerialization dataWithJSONObject:@{@"foo": @"bar"} options:0 error:nil]; +} + +#pragma mark - + +@interface AFJSONRequestSerializationTests : AFTestCase +@property (nonatomic, strong) AFJSONRequestSerializer *requestSerializer; +@end + +@implementation AFJSONRequestSerializationTests + +- (void)setUp { + self.requestSerializer = [[AFJSONRequestSerializer alloc] init]; +} + +#pragma mark - + +- (void)testThatJSONRequestSerializationHandlesParametersDictionary { + NSDictionary *parameters = @{@"key":@"value"}; + NSError *error = nil; + NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"POST" URLString:AFNetworkingTestsBaseURLString parameters:parameters error:&error]; + + XCTAssertNil(error, @"Serialization error should be nil"); + + NSString *body = [[NSString alloc] initWithData:[request HTTPBody] encoding:NSUTF8StringEncoding]; + + XCTAssertTrue([@"{\"key\":\"value\"}" isEqualToString:body], @"Parameters were not encoded correctly"); +} + +- (void)testThatJSONRequestSerializationHandlesParametersArray { + NSArray *parameters = @[@{@"key":@"value"}]; + NSError *error = nil; + NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:@"POST" URLString:AFNetworkingTestsBaseURLString parameters:parameters error:&error]; + + XCTAssertNil(error, @"Serialization error should be nil"); + + NSString *body = [[NSString alloc] initWithData:[request HTTPBody] encoding:NSUTF8StringEncoding]; + + XCTAssertTrue([@"[{\"key\":\"value\"}]" isEqualToString:body], @"Parameters were not encoded correctly"); +} + +@end + +#pragma mark - + +@interface AFJSONResponseSerializationTests : AFTestCase +@property (nonatomic, strong) AFJSONResponseSerializer *responseSerializer; +@end + +@implementation AFJSONResponseSerializationTests + +- (void)setUp { + [super setUp]; + self.responseSerializer = [AFJSONResponseSerializer serializer]; +} + +#pragma mark - + +- (void)testThatJSONResponseSerializerAcceptsApplicationJSONMimeType { + NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:self.baseURL statusCode:200 HTTPVersion:@"1.1" headerFields:@{@"Content-Type": @"application/json"}]; + + NSError *error = nil; + [self.responseSerializer validateResponse:response data:AFJSONTestData() error:&error]; + + XCTAssertNil(error, @"Error handling application/json"); +} + +- (void)testThatJSONResponseSerializerAcceptsTextJSONMimeType { + NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:self.baseURL statusCode:200 HTTPVersion:@"1.1" headerFields:@{@"Content-Type": @"text/json"}]; + NSError *error = nil; + [self.responseSerializer validateResponse:response data:AFJSONTestData()error:&error]; + + XCTAssertNil(error, @"Error handling text/json"); +} + +- (void)testThatJSONResponseSerializerAcceptsTextJavaScriptMimeType { + NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:self.baseURL statusCode:200 HTTPVersion:@"1.1" headerFields:@{@"Content-Type": @"text/javascript"}]; + NSError *error = nil; + [self.responseSerializer validateResponse:response data:AFJSONTestData() error:&error]; + + XCTAssertNil(error, @"Error handling text/javascript"); +} + +- (void)testThatJSONResponseSerializerDoesNotAcceptNonStandardJSONMimeType { + NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:self.baseURL statusCode:200 HTTPVersion:@"1.1" headerFields:@{@"Content-Type": @"nonstandard/json"}]; + NSError *error = nil; + [self.responseSerializer validateResponse:response data:AFJSONTestData() error:&error]; + + XCTAssertNotNil(error, @"Error should have been thrown for nonstandard/json"); +} + +- (void)testThatJSONResponseSerializerReturnsDictionaryForValidJSONDictionary { + NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:self.baseURL statusCode:200 HTTPVersion:@"1.1" headerFields:@{@"Content-Type": @"text/json"}]; + NSError *error = nil; + id responseObject = [self.responseSerializer responseObjectForResponse:response data:AFJSONTestData() error:&error]; + + XCTAssertNil(error, @"Serialization error should be nil"); + XCTAssert([responseObject isKindOfClass:[NSDictionary class]], @"Expected response to be a NSDictionary"); +} + +- (void)testThatJSONResponseSerializerReturnsErrorForInvalidJSON { + NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:self.baseURL statusCode:200 HTTPVersion:@"1.1" headerFields:@{@"Content-Type":@"text/json"}]; + NSError *error = nil; + [self.responseSerializer responseObjectForResponse:response data:[@"{invalid}" dataUsingEncoding:NSUTF8StringEncoding] error:&error]; + + XCTAssertNotNil(error, @"Serialization error should not be nil"); +} + +- (void)testThatJSONResponseSerializerReturnsNilObjectAndNilErrorForEmptyData { + NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:self.baseURL statusCode:200 HTTPVersion:@"1.1" headerFields:@{@"Content-Type":@"text/json"}]; + NSData *data = [NSData data]; + NSError *error = nil; + id responseObject = [self.responseSerializer responseObjectForResponse:response data:data error:&error]; + XCTAssertNil(responseObject); + XCTAssertNil(error); +} + +- (void)testThatJSONResponseSerializerReturnsNilObjectAndNilErrorForSingleSpace { + NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:self.baseURL statusCode:200 HTTPVersion:@"1.1" headerFields:@{@"Content-Type":@"text/json"}]; + NSData *data = [@" " dataUsingEncoding:NSUTF8StringEncoding]; + NSError *error = nil; + id responseObject = [self.responseSerializer responseObjectForResponse:response data:data error:&error]; + XCTAssertNil(responseObject); + XCTAssertNil(error); +} + +- (void)testThatJSONRemovesKeysWithNullValues { + self.responseSerializer.removesKeysWithNullValues = YES; + NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:self.baseURL statusCode:200 HTTPVersion:@"1.1" headerFields:@{@"Content-Type":@"text/json"}]; + NSData *data = [NSJSONSerialization dataWithJSONObject:@{@"key":@"value",@"nullkey":[NSNull null],@"array":@[@{@"subnullkey":[NSNull null]}]} + options:0 + error:nil]; + + NSError *error = nil; + NSDictionary *responseObject = [self.responseSerializer responseObjectForResponse:response + data:data + error:&error]; + XCTAssertNil(error); + XCTAssertNotNil(responseObject[@"key"]); + XCTAssertNil(responseObject[@"nullkey"]); + XCTAssertNil(responseObject[@"array"][0][@"subnullkey"]); +} + +@end diff --git a/its/plugin/projects/AFNetworking/Tests/Tests/AFNetworkActivityManagerTests.m b/its/plugin/projects/AFNetworking/Tests/Tests/AFNetworkActivityManagerTests.m new file mode 100644 index 00000000..d12e6467 --- /dev/null +++ b/its/plugin/projects/AFNetworking/Tests/Tests/AFNetworkActivityManagerTests.m @@ -0,0 +1,181 @@ +// AFNetworkActivityManagerTests.m +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "AFTestCase.h" + +#import "AFNetworkActivityIndicatorManager.h" +#import "AFHTTPSessionManager.h" + +@interface AFNetworkActivityManagerTests : AFTestCase +@property (nonatomic, strong) AFNetworkActivityIndicatorManager *networkActivityIndicatorManager; +@property (nonatomic, strong) AFHTTPSessionManager *sessionManager; +@end + +#pragma mark - + +@implementation AFNetworkActivityManagerTests + +- (void)setUp { + [super setUp]; + + self.sessionManager = [[AFHTTPSessionManager alloc] initWithBaseURL:self.baseURL sessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]]; + + self.networkActivityIndicatorManager = [[AFNetworkActivityIndicatorManager alloc] init]; + self.networkActivityIndicatorManager.enabled = YES; +} + +- (void)tearDown { + [super tearDown]; + self.networkActivityIndicatorManager = nil; + + [self.sessionManager invalidateSessionCancelingTasks:YES]; +} + +#pragma mark - + +- (void)testThatNetworkActivityIndicatorTurnsOnAndOffIndicatorWhenRequestSucceeds { + self.networkActivityIndicatorManager.activationDelay = 0.0; + self.networkActivityIndicatorManager.completionDelay = 0.0; + + XCTestExpectation *startExpectation = [self expectationWithDescription:@"Indicator Visible"]; + XCTestExpectation *endExpectation = [self expectationWithDescription:@"Indicator Hidden"]; + [self.networkActivityIndicatorManager setNetworkingActivityActionWithBlock:^(BOOL networkActivityIndicatorVisible) { + if (networkActivityIndicatorVisible) { + [startExpectation fulfill]; + } else { + [endExpectation fulfill]; + } + }]; + + XCTestExpectation *requestExpectation = [self expectationWithDescription:@"Request should succeed"]; + [self.sessionManager + GET:@"/delay/1" + parameters:nil + progress:nil + success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) { + [requestExpectation fulfill]; + } + failure:nil]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +- (void)testThatNetworkActivityIndicatorTurnsOnAndOffIndicatorWhenRequestFails { + self.networkActivityIndicatorManager.activationDelay = 0.0; + self.networkActivityIndicatorManager.completionDelay = 0.0; + + XCTestExpectation *startExpectation = [self expectationWithDescription:@"Indicator Visible"]; + XCTestExpectation *endExpectation = [self expectationWithDescription:@"Indicator Hidden"]; + [self.networkActivityIndicatorManager setNetworkingActivityActionWithBlock:^(BOOL networkActivityIndicatorVisible) { + if (networkActivityIndicatorVisible) { + [startExpectation fulfill]; + } else { + [endExpectation fulfill]; + } + }]; + + XCTestExpectation *requestExpectation = [self expectationWithDescription:@"Request should fail"]; + [self.sessionManager + GET:@"/status/404" + parameters:nil + progress:nil + success:nil + failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { + [requestExpectation fulfill]; + }]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +- (void)testThatVisibilityDelaysAreApplied { + + self.networkActivityIndicatorManager.activationDelay = 1.0; + self.networkActivityIndicatorManager.completionDelay = 1.0; + + CFTimeInterval requestStartTime = CACurrentMediaTime(); + __block CFTimeInterval requestEndTime; + __block CFTimeInterval indicatorVisbleTime; + __block CFTimeInterval indicatorHiddenTime; + XCTestExpectation *startExpectation = [self expectationWithDescription:@"Indicator Visible"]; + XCTestExpectation *endExpectation = [self expectationWithDescription:@"Indicator Hidden"]; + [self.networkActivityIndicatorManager setNetworkingActivityActionWithBlock:^(BOOL networkActivityIndicatorVisible) { + if (networkActivityIndicatorVisible) { + indicatorVisbleTime = CACurrentMediaTime(); + [startExpectation fulfill]; + } else { + indicatorHiddenTime = CACurrentMediaTime(); + [endExpectation fulfill]; + } + }]; + + XCTestExpectation *requestExpectation = [self expectationWithDescription:@"Request should succeed"]; + [self.sessionManager + GET:@"/delay/2" + parameters:nil + progress:nil + success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) { + requestEndTime = CACurrentMediaTime(); + [requestExpectation fulfill]; + } + failure:nil]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + XCTAssertTrue((indicatorVisbleTime - requestStartTime) > self.networkActivityIndicatorManager.activationDelay); + XCTAssertTrue((indicatorHiddenTime - requestEndTime) > self.networkActivityIndicatorManager.completionDelay); +} + +- (void)testThatIndicatorBlockIsOnlyCalledOnceEachForStartAndEndForMultipleRequests { + self.networkActivityIndicatorManager.activationDelay = 1.0; + self.networkActivityIndicatorManager.completionDelay = 1.0; + + XCTestExpectation *startExpectation = [self expectationWithDescription:@"Indicator Visible"]; + XCTestExpectation *endExpectation = [self expectationWithDescription:@"Indicator Hidden"]; + [self.networkActivityIndicatorManager setNetworkingActivityActionWithBlock:^(BOOL networkActivityIndicatorVisible) { + if (networkActivityIndicatorVisible) { + [startExpectation fulfill]; + } else { + [endExpectation fulfill]; + } + }]; + + XCTestExpectation *requestExpectation = [self expectationWithDescription:@"Request should succeed"]; + [self.sessionManager + GET:@"/delay/4" + parameters:nil + progress:nil + success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) { + [requestExpectation fulfill]; + } + failure:nil]; + + XCTestExpectation *secondRequestExpectation = [self expectationWithDescription:@"Request should succeed"]; + [self.sessionManager + GET:@"/delay/2" + parameters:nil + progress:nil + success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) { + + [secondRequestExpectation fulfill]; + } + failure:nil]; + + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + +} + +@end diff --git a/its/plugin/projects/AFNetworking/Tests/Tests/AFNetworkReachabilityManagerTests.m b/its/plugin/projects/AFNetworking/Tests/Tests/AFNetworkReachabilityManagerTests.m new file mode 100644 index 00000000..05b3c94e --- /dev/null +++ b/its/plugin/projects/AFNetworking/Tests/Tests/AFNetworkReachabilityManagerTests.m @@ -0,0 +1,124 @@ +// AFNetworkReachabilityManagerTests.h +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "AFTestCase.h" + +#import "AFNetworkReachabilityManager.h" +#import + +@interface AFNetworkReachabilityManagerTests : AFTestCase +@property (nonatomic, strong) AFNetworkReachabilityManager *addressReachability; +@property (nonatomic, strong) AFNetworkReachabilityManager *domainReachability; +@end + +@implementation AFNetworkReachabilityManagerTests + +- (void)setUp { + [super setUp]; + + //both of these manager objects should always be reachable when the tests are run + self.domainReachability = [AFNetworkReachabilityManager managerForDomain:@"localhost"]; + self.addressReachability = [AFNetworkReachabilityManager manager]; +} + +- (void)tearDown +{ + [self.addressReachability stopMonitoring]; + [self.domainReachability stopMonitoring]; + + [super tearDown]; +} + +- (void)testAddressReachabilityStartsInUnknownState { + XCTAssertEqual(self.addressReachability.networkReachabilityStatus, AFNetworkReachabilityStatusUnknown, + @"Reachability should start in an unknown state"); +} + +- (void)testDomainReachabilityStartsInUnknownState { + XCTAssertEqual(self.domainReachability.networkReachabilityStatus, AFNetworkReachabilityStatusUnknown, + @"Reachability should start in an unknown state"); +} + +- (void)verifyReachabilityNotificationGetsPostedWithManager:(AFNetworkReachabilityManager *)manager +{ + [self expectationForNotification:AFNetworkingReachabilityDidChangeNotification + object:nil + handler:^BOOL(NSNotification *note) { + AFNetworkReachabilityStatus status; + status = [note.userInfo[AFNetworkingReachabilityNotificationStatusItem] integerValue]; + BOOL reachable = (status == AFNetworkReachabilityStatusReachableViaWiFi + || status == AFNetworkReachabilityStatusReachableViaWWAN); + + if (reachable) { + XCTAssert(reachable, + @"Expected network to be reachable but got '%@'", + AFStringFromNetworkReachabilityStatus(status)); + XCTAssertEqual(reachable, manager.isReachable, @"Expected status to match 'isReachable'"); + } + + return reachable; + }]; + + [manager startMonitoring]; + + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +- (void)testAddressReachabilityNotification { + [self verifyReachabilityNotificationGetsPostedWithManager:self.addressReachability]; +} + +//Commenting out for Travis Stability +//- (void)testDomainReachabilityNotification { +// [self verifyReachabilityNotificationGetsPostedWithManager:self.domainReachability]; +//} + +- (void)verifyReachabilityStatusBlockGetsCalledWithManager:(AFNetworkReachabilityManager *)manager +{ + __weak XCTestExpectation *expectation = [self expectationWithDescription:@"reachability status change block gets called"]; + + typeof(manager) __weak weakManager = manager; + [manager setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) { + BOOL reachable = (status == AFNetworkReachabilityStatusReachableViaWiFi + || status == AFNetworkReachabilityStatusReachableViaWWAN); + + XCTAssert(reachable, @"Expected network to be reachable but got '%@'", AFStringFromNetworkReachabilityStatus(status)); + XCTAssertEqual(reachable, weakManager.isReachable, @"Expected status to match 'isReachable'"); + + [expectation fulfill]; + }]; + + [manager startMonitoring]; + + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + [manager setReachabilityStatusChangeBlock:nil]; + +} + +- (void)testAddressReachabilityBlock { + [self verifyReachabilityStatusBlockGetsCalledWithManager:self.addressReachability]; +} + +- (void)testDomainReachabilityBlock { + [self verifyReachabilityStatusBlockGetsCalledWithManager:self.domainReachability]; +} + +@end diff --git a/its/plugin/projects/AFNetworking/Tests/Tests/AFPropertyListResponseSerializerTests.m b/its/plugin/projects/AFNetworking/Tests/Tests/AFPropertyListResponseSerializerTests.m new file mode 100644 index 00000000..9a9212bf --- /dev/null +++ b/its/plugin/projects/AFNetworking/Tests/Tests/AFPropertyListResponseSerializerTests.m @@ -0,0 +1,66 @@ +// AFPropertyListResponseSerializerTests.m +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "AFTestCase.h" + +#import "AFURLResponseSerialization.h" + +@interface AFPropertyListResponseSerializerTests : AFTestCase +@property (nonatomic, strong) AFPropertyListResponseSerializer *responseSerializer; +@end + +@implementation AFPropertyListResponseSerializerTests + +- (void)setUp { + [super setUp]; + self.responseSerializer = [AFPropertyListResponseSerializer serializer]; +} + +#pragma mark - + +- (void)testThatPropertyListResponseSerializerHandles204 { + NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc] initWithURL:self.baseURL statusCode:204 HTTPVersion:@"1.1" headerFields:@{@"Content-Type": @"application/x-plist"}]; + NSError *error; + id responseObject = [self.responseSerializer responseObjectForResponse:response data:nil error:&error]; + + XCTAssertNil(responseObject, @"Response should be nil when handling 204 with application/x-plist"); + XCTAssertNil(error, @"Error handling application/x-plist"); +} + +- (void)testResponseSerializerCanBeCopied { + AFPropertyListResponseSerializer *copiedSerializer = [self.responseSerializer copy]; + XCTAssertNotNil(copiedSerializer); + XCTAssertNotEqual(copiedSerializer, self.responseSerializer); + XCTAssertTrue(copiedSerializer.format == self.responseSerializer.format); + XCTAssertTrue(copiedSerializer.readOptions == self.responseSerializer.readOptions); +} + +- (void)testResponseSerializerCanBeArchivedAndUnarchived { + NSData *archive = [NSKeyedArchiver archivedDataWithRootObject:self.responseSerializer]; + XCTAssertNotNil(archive); + AFPropertyListResponseSerializer *unarchivedSerializer = [NSKeyedUnarchiver unarchiveObjectWithData:archive]; + XCTAssertNotNil(unarchivedSerializer); + XCTAssertNotEqual(unarchivedSerializer, self.responseSerializer); + XCTAssertTrue(unarchivedSerializer.format == self.responseSerializer.format); + XCTAssertTrue(unarchivedSerializer.readOptions == self.responseSerializer.readOptions); +} + +@end diff --git a/its/plugin/projects/AFNetworking/Tests/Tests/AFSecurityPolicyTests.m b/its/plugin/projects/AFNetworking/Tests/Tests/AFSecurityPolicyTests.m new file mode 100644 index 00000000..4d660eb5 --- /dev/null +++ b/its/plugin/projects/AFNetworking/Tests/Tests/AFSecurityPolicyTests.m @@ -0,0 +1,654 @@ +// AFSecurityPolicyTests.m +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "AFTestCase.h" +#import "AFSecurityPolicy.h" + +@interface AFSecurityPolicyTests : AFTestCase + +@end + +static SecTrustRef AFUTTrustChainForCertsInDirectory(NSString *directoryPath) { + NSArray *certFileNames = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:directoryPath error:nil]; + NSMutableArray *certs = [NSMutableArray arrayWithCapacity:[certFileNames count]]; + for (NSString *path in certFileNames) { + NSData *certData = [NSData dataWithContentsOfFile:[directoryPath stringByAppendingPathComponent:path]]; + SecCertificateRef cert = SecCertificateCreateWithData(NULL, (__bridge CFDataRef)(certData)); + [certs addObject:(__bridge id)(cert)]; + } + + SecPolicyRef policy = SecPolicyCreateBasicX509(); + SecTrustRef trust = NULL; + SecTrustCreateWithCertificates((__bridge CFTypeRef)(certs), policy, &trust); + CFRelease(policy); + + return trust; +} + +static SecTrustRef AFUTHTTPBinOrgServerTrust() { + NSString *bundlePath = [[NSBundle bundleForClass:[AFSecurityPolicyTests class]] resourcePath]; + NSString *serverCertDirectoryPath = [bundlePath stringByAppendingPathComponent:@"HTTPBinOrgServerTrustChain"]; + + return AFUTTrustChainForCertsInDirectory(serverCertDirectoryPath); +} + +static SecTrustRef AFUTADNNetServerTrust() { + NSString *bundlePath = [[NSBundle bundleForClass:[AFSecurityPolicyTests class]] resourcePath]; + NSString *serverCertDirectoryPath = [bundlePath stringByAppendingPathComponent:@"ADNNetServerTrustChain"]; + + return AFUTTrustChainForCertsInDirectory(serverCertDirectoryPath); +} + +static SecTrustRef AFUTGoogleComServerTrustPath1() { + NSString *bundlePath = [[NSBundle bundleForClass:[AFSecurityPolicyTests class]] resourcePath]; + NSString *serverCertDirectoryPath = [bundlePath stringByAppendingPathComponent:@"GoogleComServerTrustChainPath1"]; + + return AFUTTrustChainForCertsInDirectory(serverCertDirectoryPath); +} + +static SecTrustRef AFUTGoogleComServerTrustPath2() { + NSString *bundlePath = [[NSBundle bundleForClass:[AFSecurityPolicyTests class]] resourcePath]; + NSString *serverCertDirectoryPath = [bundlePath stringByAppendingPathComponent:@"GoogleComServerTrustChainPath2"]; + + return AFUTTrustChainForCertsInDirectory(serverCertDirectoryPath); +} + +static SecCertificateRef AFUTHTTPBinOrgCertificate() { + NSString *certPath = [[NSBundle bundleForClass:[AFSecurityPolicyTests class]] pathForResource:@"httpbinorg_01192017" ofType:@"cer"]; + NSCAssert(certPath != nil, @"Path for certificate should not be nil"); + NSData *certData = [NSData dataWithContentsOfFile:certPath]; + + return SecCertificateCreateWithData(NULL, (__bridge CFDataRef)(certData)); +} + +static SecCertificateRef AFUTCOMODORSADomainValidationSecureServerCertificate() { + NSString *certPath = [[NSBundle bundleForClass:[AFSecurityPolicyTests class]] pathForResource:@"COMODO_RSA_Domain_Validation_Secure_Server_CA" ofType:@"cer"]; + NSCAssert(certPath != nil, @"Path for certificate should not be nil"); + NSData *certData = [NSData dataWithContentsOfFile:certPath]; + + return SecCertificateCreateWithData(NULL, (__bridge CFDataRef)(certData)); +} + +static SecCertificateRef AFUTCOMODORSACertificate() { + NSString *certPath = [[NSBundle bundleForClass:[AFSecurityPolicyTests class]] pathForResource:@"COMODO_RSA_Certification_Authority" ofType:@"cer"]; + NSCAssert(certPath != nil, @"Path for certificate should not be nil"); + NSData *certData = [NSData dataWithContentsOfFile:certPath]; + + return SecCertificateCreateWithData(NULL, (__bridge CFDataRef)(certData)); +} + +static SecCertificateRef AFUTAddTrustExternalRootCertificate() { + NSString *certPath = [[NSBundle bundleForClass:[AFSecurityPolicyTests class]] pathForResource:@"AddTrust_External_CA_Root" ofType:@"cer"]; + NSCAssert(certPath != nil, @"Path for certificate should not be nil"); + NSData *certData = [NSData dataWithContentsOfFile:certPath]; + + return SecCertificateCreateWithData(NULL, (__bridge CFDataRef)(certData)); +} + +static SecCertificateRef AFUTGoogleComEquifaxSecureCARootCertificate() { + NSString *certPath = [[NSBundle bundleForClass:[AFSecurityPolicyTests class]] pathForResource:@"Equifax_Secure_Certificate_Authority_Root" ofType:@"cer"]; + NSCAssert(certPath != nil, @"Path for certificate should not be nil"); + NSData *certData = [NSData dataWithContentsOfFile:certPath]; + + return SecCertificateCreateWithData(NULL, (__bridge CFDataRef)(certData)); +} + +static SecCertificateRef AFUTGoogleComGeoTrustGlobalCARootCertificate() { + NSString *certPath = [[NSBundle bundleForClass:[AFSecurityPolicyTests class]] pathForResource:@"GeoTrust_Global_CA_Root" ofType:@"cer"]; + NSCAssert(certPath != nil, @"Path for certificate should not be nil"); + NSData *certData = [NSData dataWithContentsOfFile:certPath]; + + return SecCertificateCreateWithData(NULL, (__bridge CFDataRef)(certData)); +} + +static SecCertificateRef AFUTSelfSignedCertificateWithoutDomain() { + NSString *certPath = [[NSBundle bundleForClass:[AFSecurityPolicyTests class]] pathForResource:@"NoDomains" ofType:@"cer"]; + NSCAssert(certPath != nil, @"Path for certificate should not be nil"); + NSData *certData = [NSData dataWithContentsOfFile:certPath]; + + return SecCertificateCreateWithData(NULL, (__bridge CFDataRef)(certData)); +} + +static SecCertificateRef AFUTSelfSignedCertificateWithCommonNameDomain() { + NSString *certPath = [[NSBundle bundleForClass:[AFSecurityPolicyTests class]] pathForResource:@"foobar.com" ofType:@"cer"]; + NSCAssert(certPath != nil, @"Path for certificate should not be nil"); + NSData *certData = [NSData dataWithContentsOfFile:certPath]; + + return SecCertificateCreateWithData(NULL, (__bridge CFDataRef)(certData)); +} + +static SecCertificateRef AFUTSelfSignedCertificateWithDNSNameDomain() { + NSString *certPath = [[NSBundle bundleForClass:[AFSecurityPolicyTests class]] pathForResource:@"AltName" ofType:@"cer"]; + NSCAssert(certPath != nil, @"Path for certificate should not be nil"); + NSData *certData = [NSData dataWithContentsOfFile:certPath]; + + return SecCertificateCreateWithData(NULL, (__bridge CFDataRef)(certData)); +} + +static SecTrustRef AFUTTrustWithCertificate(SecCertificateRef certificate) { + NSArray *certs = @[(__bridge id)(certificate)]; + + SecPolicyRef policy = SecPolicyCreateBasicX509(); + SecTrustRef trust = NULL; + SecTrustCreateWithCertificates((__bridge CFTypeRef)(certs), policy, &trust); + CFRelease(policy); + + return trust; +} + +@implementation AFSecurityPolicyTests + +#pragma mark - Default Policy Tests +#pragma mark Default Values Test + +- (void)testDefaultPolicyPinningModeIsSetToNone { + AFSecurityPolicy *policy = [AFSecurityPolicy defaultPolicy]; + XCTAssertTrue(policy.SSLPinningMode == AFSSLPinningModeNone, @"Pinning Mode should be set to by default"); +} + +- (void)testDefaultPolicyHasInvalidCertificatesAreDisabledByDefault { + AFSecurityPolicy *policy = [AFSecurityPolicy defaultPolicy]; + XCTAssertFalse(policy.allowInvalidCertificates, @"Invalid Certificates Should Be Disabled by Default"); +} + +- (void)testDefaultPolicyHasDomainNamesAreValidatedByDefault { + AFSecurityPolicy *policy = [AFSecurityPolicy defaultPolicy]; + XCTAssertTrue(policy.validatesDomainName, @"Domain names should be validated by default"); +} + +- (void)testDefaultPolicyHasNoPinnedCertificates { + AFSecurityPolicy *policy = [AFSecurityPolicy defaultPolicy]; + XCTAssertTrue(policy.pinnedCertificates.count == 0, @"The default policy should not have any pinned certificates"); +} + +#pragma mark Positive Server Trust Evaluation Tests + +- (void)testDefaultPolicyDoesAllowHTTPBinOrgCertificate { + AFSecurityPolicy *policy = [AFSecurityPolicy defaultPolicy]; + SecTrustRef trust = AFUTHTTPBinOrgServerTrust(); + XCTAssertTrue([policy evaluateServerTrust:trust forDomain:nil], @"Valid Certificate should be allowed by default."); +} + +- (void)testDefaultPolicyDoesAllowHTTPBinOrgCertificateForValidDomainName { + AFSecurityPolicy *policy = [AFSecurityPolicy defaultPolicy]; + SecTrustRef trust = AFUTHTTPBinOrgServerTrust(); + XCTAssertTrue([policy evaluateServerTrust:trust forDomain:@"httpbin.org"], @"Valid Certificate should be allowed by default."); +} + +#pragma mark Negative Server Trust Evaluation Tests + +- (void)testDefaultPolicyDoesNotAllowInvalidCertificate { + AFSecurityPolicy *policy = [AFSecurityPolicy defaultPolicy]; + SecCertificateRef certificate = AFUTSelfSignedCertificateWithoutDomain(); + SecTrustRef trust = AFUTTrustWithCertificate(certificate); + XCTAssertFalse([policy evaluateServerTrust:trust forDomain:nil], @"Invalid Certificates should not be allowed"); +} + +- (void)testDefaultPolicyDoesNotAllowCertificateWithInvalidDomainName { + AFSecurityPolicy *policy = [AFSecurityPolicy defaultPolicy]; + SecTrustRef trust = AFUTHTTPBinOrgServerTrust(); + XCTAssertFalse([policy evaluateServerTrust:trust forDomain:@"apple.com"], @"Certificate should not be allowed because the domain names do not match."); +} + +#pragma mark - Public Key Pinning Tests +#pragma mark Default Values Tests + +- (void)testPolicyWithPublicKeyPinningModeHasPinnedCertificates { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey]; + XCTAssertTrue(policy.pinnedCertificates > 0, @"Policy should contain default pinned certificates"); +} + +- (void)testPolicyWithPublicKeyPinningModeHasHTTPBinOrgPinnedCertificate { + NSBundle *bundle = [NSBundle bundleForClass:[self class]]; + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey withPinnedCertificates:[AFSecurityPolicy certificatesInBundle:bundle]]; + + SecCertificateRef cert = AFUTHTTPBinOrgCertificate(); + NSData *certData = (__bridge NSData *)(SecCertificateCopyData(cert)); + CFRelease(cert); + NSSet *set = [policy.pinnedCertificates objectsPassingTest:^BOOL(NSData *data, BOOL *stop) { + return [data isEqualToData:certData]; + }]; + + XCTAssertEqual(set.count, 1, @"HTTPBin.org certificate not found in the default certificates"); +} + +#pragma mark Positive Server Trust Evaluation Tests +- (void)testPolicyWithPublicKeyPinningAllowsHTTPBinOrgServerTrustWithHTTPBinOrgLeafCertificatePinned { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey]; + + SecCertificateRef certificate = AFUTHTTPBinOrgCertificate(); + policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(certificate)]; + XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow server trust"); +} + +- (void)testPolicyWithPublicKeyPinningAllowsHTTPBinOrgServerTrustWithHTTPBinOrgIntermediate1CertificatePinned { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey]; + + SecCertificateRef certificate = AFUTCOMODORSADomainValidationSecureServerCertificate(); + policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(certificate)]; + XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow server trust"); +} + +- (void)testPolicyWithPublicKeyPinningAllowsHTTPBinOrgServerTrustWithHTTPBinOrgIntermediate2CertificatePinned { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey]; + + SecCertificateRef certificate = AFUTCOMODORSACertificate(); + policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(certificate)]; + XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow server trust"); +} + +- (void)testPolicyWithPublicKeyPinningAllowsHTTPBinOrgServerTrustWithHTTPBinOrgRootCertificatePinned { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey]; + + SecCertificateRef certificate = AFUTAddTrustExternalRootCertificate(); + policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(certificate)]; + XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow server trust"); +} + +- (void)testPolicyWithPublicKeyPinningAllowsHTTPBinOrgServerTrustWithEntireCertificateChainPinned { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey]; + + SecCertificateRef httpBinCertificate = AFUTHTTPBinOrgCertificate(); + SecCertificateRef intermedaite1Certificate = AFUTCOMODORSADomainValidationSecureServerCertificate(); + SecCertificateRef intermedaite2Certificate = AFUTCOMODORSACertificate(); + SecCertificateRef rootCertificate = AFUTAddTrustExternalRootCertificate(); + [policy setPinnedCertificates:[NSSet setWithObjects:(__bridge_transfer NSData *)SecCertificateCopyData(httpBinCertificate), + (__bridge_transfer NSData *)SecCertificateCopyData(intermedaite1Certificate), + (__bridge_transfer NSData *)SecCertificateCopyData(intermedaite2Certificate), + (__bridge_transfer NSData *)SecCertificateCopyData(rootCertificate), nil]]; + XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow HTTPBinOrg server trust because at least one of the pinned certificates is valid"); + +} + +- (void)testPolicyWithPublicKeyPinningAllowsHTTPBirnOrgServerTrustWithHTTPbinOrgPinnedCertificateAndAdditionalPinnedCertificates { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey]; + + SecCertificateRef httpBinCertificate = AFUTHTTPBinOrgCertificate(); + SecCertificateRef selfSignedCertificate = AFUTSelfSignedCertificateWithCommonNameDomain(); + [policy setPinnedCertificates:[NSSet setWithObjects:(__bridge_transfer NSData *)SecCertificateCopyData(httpBinCertificate), + (__bridge_transfer NSData *)SecCertificateCopyData(selfSignedCertificate), nil]]; + XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow HTTPBinOrg server trust because at least one of the pinned certificates is valid"); +} + +- (void)testPolicyWithPublicKeyPinningAllowsHTTPBinOrgServerTrustWithHTTPBinOrgLeafCertificatePinnedAndValidDomainName { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey]; + + SecCertificateRef certificate = AFUTHTTPBinOrgCertificate(); + policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(certificate)]; + XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:@"httpbin.org"], @"Policy should allow server trust"); +} + +#pragma mark Negative Server Trust Evaluation Tests + +- (void)testPolicyWithPublicKeyPinningAndNoPinnedCertificatesDoesNotAllowHTTPBinOrgServerTrust { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey]; + policy.pinnedCertificates = [NSSet set]; + XCTAssertFalse([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should not allow server trust because the policy is set to public key pinning and it does not contain any pinned certificates."); +} + +- (void)testPolicyWithPublicKeyPinningDoesNotAllowADNServerTrustWithHTTPBinOrgPinnedCertificate { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey]; + + SecCertificateRef certificate = AFUTHTTPBinOrgCertificate(); + policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(certificate)]; + XCTAssertFalse([policy evaluateServerTrust:AFUTADNNetServerTrust() forDomain:nil], @"Policy should not allow ADN server trust for pinned HTTPBin.org certificate"); +} + +- (void)testPolicyWithPublicKeyPinningDoesNotAllowHTTPBinOrgServerTrustWithHTTPBinOrgLeafCertificatePinnedAndInvalidDomainName { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey]; + + SecCertificateRef certificate = AFUTHTTPBinOrgCertificate(); + policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(certificate)]; + XCTAssertFalse([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:@"invaliddomainname.com"], @"Policy should not allow server trust"); +} + +- (void)testPolicyWithPublicKeyPinningDoesNotAllowADNServerTrustWithMultipleInvalidPinnedCertificates { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey]; + + SecCertificateRef httpBinCertificate = AFUTHTTPBinOrgCertificate(); + SecCertificateRef selfSignedCertificate = AFUTSelfSignedCertificateWithCommonNameDomain(); + [policy setPinnedCertificates:[NSSet setWithObjects:(__bridge_transfer NSData *)SecCertificateCopyData(httpBinCertificate), + (__bridge_transfer NSData *)SecCertificateCopyData(selfSignedCertificate), nil]]; + XCTAssertFalse([policy evaluateServerTrust:AFUTADNNetServerTrust() forDomain:nil], @"Policy should not allow ADN server trust because there are no matching pinned certificates"); +} + +#pragma mark - Certificate Pinning Tests +#pragma mark Default Values Tests + +- (void)testPolicyWithCertificatePinningModeHasPinnedCertificates { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate]; + XCTAssertTrue(policy.pinnedCertificates > 0, @"Policy should contain default pinned certificates"); +} + +- (void)testPolicyWithCertificatePinningModeHasHTTPBinOrgPinnedCertificate { + NSBundle *bundle = [NSBundle bundleForClass:[self class]]; + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate withPinnedCertificates:[AFSecurityPolicy certificatesInBundle:bundle]]; + + SecCertificateRef cert = AFUTHTTPBinOrgCertificate(); + NSData *certData = (__bridge NSData *)(SecCertificateCopyData(cert)); + CFRelease(cert); + NSSet *set = [policy.pinnedCertificates objectsPassingTest:^BOOL(NSData *data, BOOL *stop) { + return [data isEqualToData:certData]; + }]; + + XCTAssertEqual(set.count, 1, @"HTTPBin.org certificate not found in the default certificates"); +} + +#pragma mark Positive Server Trust Evaluation Tests +- (void)testPolicyWithCertificatePinningAllowsHTTPBinOrgServerTrustWithHTTPBinOrgLeafCertificatePinned { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate]; + + SecCertificateRef certificate = AFUTHTTPBinOrgCertificate(); + policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(certificate)]; + XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow server trust"); +} + +- (void)testPolicyWithCertificatePinningAllowsHTTPBinOrgServerTrustWithHTTPBinOrgIntermediate1CertificatePinned { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate]; + + SecCertificateRef certificate = AFUTCOMODORSADomainValidationSecureServerCertificate(); + policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(certificate)]; + XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow server trust"); +} + +- (void)testPolicyWithCertificatePinningAllowsHTTPBinOrgServerTrustWithHTTPBinOrgIntermediate2CertificatePinned { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate]; + + SecCertificateRef certificate = AFUTCOMODORSACertificate(); + policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(certificate)]; + XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow server trust"); +} + +- (void)testPolicyWithCertificatePinningAllowsHTTPBinOrgServerTrustWithHTTPBinOrgRootCertificatePinned { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate]; + + SecCertificateRef certificate = AFUTAddTrustExternalRootCertificate(); + policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(certificate)]; + XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow server trust"); +} + +- (void)testPolicyWithCertificatePinningAllowsHTTPBinOrgServerTrustWithEntireCertificateChainPinned { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate]; + + SecCertificateRef httpBinCertificate = AFUTHTTPBinOrgCertificate(); + SecCertificateRef intermedaite1Certificate = AFUTCOMODORSADomainValidationSecureServerCertificate(); + SecCertificateRef intermedaite2Certificate = AFUTCOMODORSACertificate(); + SecCertificateRef rootCertificate = AFUTAddTrustExternalRootCertificate(); + [policy setPinnedCertificates:[NSSet setWithObjects:(__bridge_transfer NSData *)SecCertificateCopyData(httpBinCertificate), + (__bridge_transfer NSData *)SecCertificateCopyData(intermedaite1Certificate), + (__bridge_transfer NSData *)SecCertificateCopyData(intermedaite2Certificate), + (__bridge_transfer NSData *)SecCertificateCopyData(rootCertificate), nil]]; + XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow HTTPBinOrg server trust because at least one of the pinned certificates is valid"); + +} + +- (void)testPolicyWithCertificatePinningAllowsHTTPBirnOrgServerTrustWithHTTPbinOrgPinnedCertificateAndAdditionalPinnedCertificates { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate]; + + SecCertificateRef httpBinCertificate = AFUTHTTPBinOrgCertificate(); + SecCertificateRef selfSignedCertificate = AFUTSelfSignedCertificateWithCommonNameDomain(); + [policy setPinnedCertificates:[NSSet setWithObjects:(__bridge_transfer NSData *)SecCertificateCopyData(httpBinCertificate), + (__bridge_transfer NSData *)SecCertificateCopyData(selfSignedCertificate), nil]]; + XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should allow HTTPBinOrg server trust because at least one of the pinned certificates is valid"); +} + +- (void)testPolicyWithCertificatePinningAllowsHTTPBinOrgServerTrustWithHTTPBinOrgLeafCertificatePinnedAndValidDomainName { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate]; + + SecCertificateRef certificate = AFUTHTTPBinOrgCertificate(); + policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(certificate)]; + XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:@"httpbin.org"], @"Policy should allow server trust"); +} + +//- (void)testPolicyWithCertificatePinningAllowsGoogleComServerTrustIncompleteChainWithRootCertificatePinnedAndValidDomainName { +// //TODO THIS TEST HAS BEEN DISABLED UNTIL CERTS HAVE BEEN UPDATED. +// //Please see conversation here: https://github.com/AFNetworking/AFNetworking/pull/3159#issuecomment-178647437 +// // +// // Fix certificate validation for servers providing incomplete chains (#3159) - test case +// // +// // google.com has two certification paths and both send incomplete certificate chains, i.e. don't include the Root CA +// // (this can be validated in https://www.ssllabs.com/ssltest/analyze.html?d=google.com) +// // +// // The two certification paths are: +// // - Path 1: *.google.com, Google Internet Authority G2 (with GeoTrust Global CA Root) +// // - Path 2: *.google.com, Google Internet Authority G2, GeoTrust Global CA (cross signed) (with Equifax Secure CA Root) +// // +// // The common goal of using certificate pinning is to prevent MiTM (man-in-the-middle) attacks, so the Root CA's should be pinned to protect the entire chains. +// // Since there's no Root CA being sent, when `-evaluateServerTrust:` invokes `AFCertificateTrustChainForServerTrust(serverTrust)`, the Root CA isn't present +// // Therefore, even though `AFServerTrustIsValid(serverTrust)` succeeds, the next validation fails since no pinned certificate matches the `pinnedCertificates`. +// // By fetching the `AFCertificateTrustChainForServerTrust(serverTrust)` *after* the `AFServerTrustIsValid(serverTrust)` validation, the complete chain is obtained and the Root CA's match. +// +// AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate]; +// +// // certification path 1 +// SecCertificateRef certificate = AFUTGoogleComGeoTrustGlobalCARootCertificate(); +// policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(certificate)]; +// +// XCTAssertTrue([policy evaluateServerTrust:AFUTGoogleComServerTrustPath1() forDomain:@"google.com"], @"Policy should allow server trust"); +// +// // certification path 2 +// certificate = AFUTGoogleComEquifaxSecureCARootCertificate(); +// policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(certificate)]; +// +// XCTAssertTrue([policy evaluateServerTrust:AFUTGoogleComServerTrustPath2() forDomain:@"google.com"], @"Policy should allow server trust"); +//} + +#pragma mark Negative Server Trust Evaluation Tests + +- (void)testPolicyWithCertificatePinningAndNoPinnedCertificatesDoesNotAllowHTTPBinOrgServerTrust { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate]; + policy.pinnedCertificates = [NSSet set]; + XCTAssertFalse([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:nil], @"Policy should not allow server trust because the policy does not contain any pinned certificates."); +} + +- (void)testPolicyWithCertificatePinningDoesNotAllowADNServerTrustWithHTTPBinOrgPinnedCertificate { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate]; + + SecCertificateRef certificate = AFUTHTTPBinOrgCertificate(); + policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(certificate)]; + XCTAssertFalse([policy evaluateServerTrust:AFUTADNNetServerTrust() forDomain:nil], @"Policy should not allow ADN server trust for pinned HTTPBin.org certificate"); +} + +- (void)testPolicyWithCertificatePinningDoesNotAllowHTTPBinOrgServerTrustWithHTTPBinOrgLeafCertificatePinnedAndInvalidDomainName { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate]; + + SecCertificateRef certificate = AFUTHTTPBinOrgCertificate(); + policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(certificate)]; + XCTAssertFalse([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:@"invaliddomainname.com"], @"Policy should not allow server trust"); +} + +- (void)testPolicyWithCertificatePinningDoesNotAllowADNServerTrustWithMultipleInvalidPinnedCertificates { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate]; + + SecCertificateRef httpBinCertificate = AFUTHTTPBinOrgCertificate(); + SecCertificateRef selfSignedCertificate = AFUTSelfSignedCertificateWithCommonNameDomain(); + [policy setPinnedCertificates:[NSSet setWithObjects:(__bridge_transfer NSData *)SecCertificateCopyData(httpBinCertificate), + (__bridge_transfer NSData *)SecCertificateCopyData(selfSignedCertificate), nil]]; + XCTAssertFalse([policy evaluateServerTrust:AFUTADNNetServerTrust() forDomain:nil], @"Policy should not allow ADN server trust because there are no matching pinned certificates"); +} + +#pragma mark - Domain Name Validation Tests +#pragma mark Positive Evaluation Tests + +- (void)testThatPolicyWithoutDomainNameValidationAllowsServerTrustWithInvalidDomainName { + AFSecurityPolicy *policy = [AFSecurityPolicy defaultPolicy]; + [policy setValidatesDomainName:NO]; + XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:@"invalid.org"], @"Policy should allow server trust because domain name validation is disabled"); +} + +- (void)testThatPolicyWithDomainNameValidationAllowsServerTrustWithValidWildcardDomainName { + AFSecurityPolicy *policy = [AFSecurityPolicy defaultPolicy]; + XCTAssertTrue([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:@"test.httpbin.org"], @"Policy should allow server trust"); +} + +- (void)testThatPolicyWithDomainNameValidationAndSelfSignedCommonNameCertificateAllowsServerTrust { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey]; + + SecCertificateRef certificate = AFUTSelfSignedCertificateWithCommonNameDomain(); + SecTrustRef trust = AFUTTrustWithCertificate(certificate); + [policy setPinnedCertificates:[NSSet setWithObject:(__bridge_transfer NSData *)SecCertificateCopyData(certificate)]]; + [policy setAllowInvalidCertificates:YES]; + + XCTAssertTrue([policy evaluateServerTrust:trust forDomain:@"foobar.com"], @"Policy should allow server trust"); +} + +- (void)testThatPolicyWithDomainNameValidationAndSelfSignedDNSCertificateAllowsServerTrust { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey]; + + SecCertificateRef certificate = AFUTSelfSignedCertificateWithDNSNameDomain(); + SecTrustRef trust = AFUTTrustWithCertificate(certificate); + [policy setPinnedCertificates:[NSSet setWithObject:(__bridge_transfer NSData *)SecCertificateCopyData(certificate)]]; + [policy setAllowInvalidCertificates:YES]; + + XCTAssertTrue([policy evaluateServerTrust:trust forDomain:@"foobar.com"], @"Policy should allow server trust"); +} + +#pragma mark Negative Evaluation Tests + +- (void)testThatPolicyWithDomainNameValidationDoesNotAllowServerTrustWithInvalidDomainName { + AFSecurityPolicy *policy = [AFSecurityPolicy defaultPolicy]; + XCTAssertFalse([policy evaluateServerTrust:AFUTHTTPBinOrgServerTrust() forDomain:@"invalid.org"], @"Policy should not allow allow server trust"); +} + +- (void)testThatPolicyWithDomainNameValidationAndSelfSignedNoDomainCertificateDoesNotAllowServerTrust { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate]; + + SecCertificateRef certificate = AFUTSelfSignedCertificateWithoutDomain(); + SecTrustRef trust = AFUTTrustWithCertificate(certificate); + [policy setPinnedCertificates:[NSSet setWithObject:(__bridge_transfer NSData *)SecCertificateCopyData(certificate)]]; + [policy setAllowInvalidCertificates:YES]; + + XCTAssertFalse([policy evaluateServerTrust:trust forDomain:@"foobar.com"], @"Policy should not allow server trust"); +} + +#pragma mark - Self Signed Certificate Tests +#pragma mark Positive Test Cases + +- (void)testThatPolicyWithInvalidCertificatesAllowedAllowsSelfSignedServerTrust { + AFSecurityPolicy *policy = [AFSecurityPolicy defaultPolicy]; + [policy setAllowInvalidCertificates:YES]; + + SecCertificateRef certificate = AFUTSelfSignedCertificateWithDNSNameDomain(); + SecTrustRef trust = AFUTTrustWithCertificate(certificate); + + XCTAssertTrue([policy evaluateServerTrust:trust forDomain:nil], @"Policy should allow server trust because invalid certificates are allowed"); +} + +- (void)testThatPolicyWithInvalidCertificatesAllowedAndValidPinnedCertificatesDoesAllowSelfSignedServerTrustForValidDomainName { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey]; + [policy setAllowInvalidCertificates:YES]; + SecCertificateRef certificate = AFUTSelfSignedCertificateWithDNSNameDomain(); + SecTrustRef trust = AFUTTrustWithCertificate(certificate); + [policy setPinnedCertificates:[NSSet setWithObject:(__bridge_transfer NSData *)SecCertificateCopyData(certificate)]]; + + XCTAssertTrue([policy evaluateServerTrust:trust forDomain:@"foobar.com"], @"Policy should allow server trust because invalid certificates are allowed"); +} + +- (void)testThatPolicyWithInvalidCertificatesAllowedAndNoSSLPinningAndDomainNameValidationDisabledDoesAllowSelfSignedServerTrustForValidDomainName { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone]; + [policy setAllowInvalidCertificates:YES]; + [policy setValidatesDomainName:NO]; + + SecCertificateRef certificate = AFUTSelfSignedCertificateWithDNSNameDomain(); + SecTrustRef trust = AFUTTrustWithCertificate(certificate); + + XCTAssertTrue([policy evaluateServerTrust:trust forDomain:@"foobar.com"], @"Policy should allow server trust because invalid certificates are allowed"); +} + +#pragma mark Negative Test Cases + +- (void)testThatPolicyWithInvalidCertificatesDisabledDoesNotAllowSelfSignedServerTrust { + AFSecurityPolicy *policy = [AFSecurityPolicy defaultPolicy]; + + SecCertificateRef certificate = AFUTSelfSignedCertificateWithDNSNameDomain(); + SecTrustRef trust = AFUTTrustWithCertificate(certificate); + + XCTAssertFalse([policy evaluateServerTrust:trust forDomain:nil], @"Policy should not allow server trust because invalid certificates are not allowed"); +} + +- (void)testThatPolicyWithInvalidCertificatesAllowedAndNoPinnedCertificatesAndPublicKeyPinningModeDoesNotAllowSelfSignedServerTrustForValidDomainName { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModePublicKey]; + [policy setAllowInvalidCertificates:YES]; + [policy setPinnedCertificates:[NSSet set]]; + SecCertificateRef certificate = AFUTSelfSignedCertificateWithDNSNameDomain(); + SecTrustRef trust = AFUTTrustWithCertificate(certificate); + + XCTAssertFalse([policy evaluateServerTrust:trust forDomain:@"foobar.com"], @"Policy should not allow server trust because invalid certificates are allowed but there are no pinned certificates"); +} + +- (void)testThatPolicyWithInvalidCertificatesAllowedAndValidPinnedCertificatesAndNoPinningModeDoesNotAllowSelfSignedServerTrustForValidDomainName { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone]; + [policy setAllowInvalidCertificates:YES]; + SecCertificateRef certificate = AFUTSelfSignedCertificateWithDNSNameDomain(); + SecTrustRef trust = AFUTTrustWithCertificate(certificate); + [policy setPinnedCertificates:[NSSet setWithObject:(__bridge_transfer NSData *)SecCertificateCopyData(certificate)]]; + + XCTAssertFalse([policy evaluateServerTrust:trust forDomain:@"foobar.com"], @"Policy should not allow server trust because invalid certificates are allowed but there are no pinned certificates"); +} + +- (void)testThatPolicyWithInvalidCertificatesAllowedAndNoValidPinnedCertificatesAndNoPinningModeAndDomainValidationDoesNotAllowSelfSignedServerTrustForValidDomainName { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeNone]; + [policy setAllowInvalidCertificates:YES]; + [policy setPinnedCertificates:[NSSet set]]; + + SecCertificateRef certificate = AFUTSelfSignedCertificateWithDNSNameDomain(); + SecTrustRef trust = AFUTTrustWithCertificate(certificate); + + XCTAssertFalse([policy evaluateServerTrust:trust forDomain:@"foobar.com"], @"Policy should not allow server trust because invalid certificates are allowed but there are no pinned certificates"); +} + +#pragma mark - NSCopying +- (void)testThatPolicyCanBeCopied { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate]; + policy.allowInvalidCertificates = YES; + policy.validatesDomainName = NO; + policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(AFUTHTTPBinOrgCertificate())]; + + AFSecurityPolicy *copiedPolicy = [policy copy]; + XCTAssertNotEqual(copiedPolicy, policy); + XCTAssertEqual(copiedPolicy.allowInvalidCertificates, policy.allowInvalidCertificates); + XCTAssertEqual(copiedPolicy.validatesDomainName, policy.validatesDomainName); + XCTAssertEqual(copiedPolicy.SSLPinningMode, policy.SSLPinningMode); + XCTAssertTrue([copiedPolicy.pinnedCertificates isEqualToSet:policy.pinnedCertificates]); +} + +- (void)testThatPolicyCanBeEncodedAndDecoded { + AFSecurityPolicy *policy = [AFSecurityPolicy policyWithPinningMode:AFSSLPinningModeCertificate]; + policy.allowInvalidCertificates = YES; + policy.validatesDomainName = NO; + policy.pinnedCertificates = [NSSet setWithObject:(__bridge_transfer id)SecCertificateCopyData(AFUTHTTPBinOrgCertificate())]; + + NSMutableData *archiveData = [NSMutableData new]; + NSKeyedArchiver *archiver = [[NSKeyedArchiver alloc] initForWritingWithMutableData:archiveData]; + [archiver encodeObject:policy forKey:@"policy"]; + [archiver finishEncoding]; + + NSKeyedUnarchiver *unarchiver = [[NSKeyedUnarchiver alloc] initForReadingWithData:archiveData]; + AFSecurityPolicy *unarchivedPolicy = [unarchiver decodeObjectOfClass:[AFSecurityPolicy class] forKey:@"policy"]; + + XCTAssertNotEqual(unarchivedPolicy, policy); + XCTAssertEqual(unarchivedPolicy.allowInvalidCertificates, policy.allowInvalidCertificates); + XCTAssertEqual(unarchivedPolicy.validatesDomainName, policy.validatesDomainName); + XCTAssertEqual(unarchivedPolicy.SSLPinningMode, policy.SSLPinningMode); + XCTAssertTrue([unarchivedPolicy.pinnedCertificates isEqualToSet:policy.pinnedCertificates]); +} + +@end diff --git a/its/plugin/projects/AFNetworking/Tests/Tests/AFTestCase.h b/its/plugin/projects/AFNetworking/Tests/Tests/AFTestCase.h new file mode 100644 index 00000000..4f0d02ec --- /dev/null +++ b/its/plugin/projects/AFNetworking/Tests/Tests/AFTestCase.h @@ -0,0 +1,33 @@ +// AFTestCase.h +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import + +extern NSString * const AFNetworkingTestsBaseURLString; + +@interface AFTestCase : XCTestCase + +@property (nonatomic, strong, readonly) NSURL *baseURL; +@property (nonatomic, assign) NSTimeInterval networkTimeout; + +- (void)waitForExpectationsWithCommonTimeoutUsingHandler:(XCWaitCompletionHandler)handler; + +@end diff --git a/its/plugin/projects/AFNetworking/Tests/Tests/AFTestCase.m b/its/plugin/projects/AFNetworking/Tests/Tests/AFTestCase.m new file mode 100644 index 00000000..489c8ab0 --- /dev/null +++ b/its/plugin/projects/AFNetworking/Tests/Tests/AFTestCase.m @@ -0,0 +1,47 @@ +// AFTestCase.m +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "AFTestCase.h" + +NSString * const AFNetworkingTestsBaseURLString = @"https://httpbin.org/"; + +@implementation AFTestCase + +- (void)setUp { + [super setUp]; + self.networkTimeout = 20.0; +} + +- (void)tearDown { + [super tearDown]; +} + +#pragma mark - + +- (NSURL *)baseURL { + return [NSURL URLWithString:AFNetworkingTestsBaseURLString]; +} + +- (void)waitForExpectationsWithCommonTimeoutUsingHandler:(XCWaitCompletionHandler)handler { + [self waitForExpectationsWithTimeout:self.networkTimeout handler:handler]; +} + +@end diff --git a/its/plugin/projects/AFNetworking/Tests/Tests/AFUIActivityIndicatorViewTests.m b/its/plugin/projects/AFNetworking/Tests/Tests/AFUIActivityIndicatorViewTests.m new file mode 100644 index 00000000..89202f3e --- /dev/null +++ b/its/plugin/projects/AFNetworking/Tests/Tests/AFUIActivityIndicatorViewTests.m @@ -0,0 +1,111 @@ +// AFUIActivityIndicatorViewTests.h +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "AFTestCase.h" +#import "UIActivityIndicatorView+AFNetworking.h" +#import "AFURLSessionManager.h" + +@interface AFUIActivityIndicatorViewTests : AFTestCase +@property (nonatomic, strong) NSURLRequest *request; +@property (nonatomic, strong) UIActivityIndicatorView *activityIndicatorView; +@property (nonatomic, strong) AFURLSessionManager *sessionManager; +@end + +@implementation AFUIActivityIndicatorViewTests + +- (void)setUp { + [super setUp]; + self.activityIndicatorView = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhite]; + self.request = [NSURLRequest requestWithURL:[self.baseURL URLByAppendingPathComponent:@"delay/1"]]; + self.sessionManager = [[AFURLSessionManager alloc] initWithSessionConfiguration:nil]; +} + +- (void)tearDown { + [super tearDown]; + [self.sessionManager invalidateSessionCancelingTasks:YES]; + self.sessionManager = nil; +} + +- (void)testTaskDidResumeNotificationDoesNotCauseCrashForAIVWithTask { + XCTestExpectation *expectation = [self expectationWithDescription:@"No Crash"]; + [self expectationForNotification:AFNetworkingTaskDidResumeNotification object:nil handler:nil]; + NSURLSessionDataTask *task = [self.sessionManager + dataTaskWithRequest:self.request + completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) { + [expectation fulfill]; + }]; + + [self.activityIndicatorView setAnimatingWithStateOfTask:task]; + self.activityIndicatorView = nil; + + [task resume]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + [task cancel]; +} + + +- (void)testTaskDidCompleteNotificationDoesNotCauseCrashForAIVWithTask { + XCTestExpectation *expectation = [self expectationWithDescription:@"No Crash"]; + [self expectationForNotification:AFNetworkingTaskDidCompleteNotification object:nil handler:nil]; + NSURLSessionDataTask *task = [self.sessionManager + dataTaskWithRequest:self.request + completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) { + //Without the dispatch after, this test would PASS errorenously because the test + //would finish before the notification was posted to all objects that were + //observing it. + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [expectation fulfill]; + }); + }]; + + [self.activityIndicatorView setAnimatingWithStateOfTask:task]; + self.activityIndicatorView = nil; + + [task resume]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + [task cancel]; +} + +- (void)testTaskDidSuspendNotificationDoesNotCauseCrashForAIVWithTask { + XCTestExpectation *expectation = [self expectationWithDescription:@"No Crash"]; + [self expectationForNotification:AFNetworkingTaskDidSuspendNotification object:nil handler:nil]; + NSURLSessionDataTask *task = [self.sessionManager + dataTaskWithRequest:self.request + completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) { + //Without the dispatch after, this test would PASS errorenously because the test + //would finish before the notification was posted to all objects that were + //observing it. + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [expectation fulfill]; + }); + }]; + + [self.activityIndicatorView setAnimatingWithStateOfTask:task]; + self.activityIndicatorView = nil; + + [task resume]; + [task suspend]; + [task resume]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + [task cancel]; +} + +@end diff --git a/its/plugin/projects/AFNetworking/Tests/Tests/AFUIButtonTests.m b/its/plugin/projects/AFNetworking/Tests/Tests/AFUIButtonTests.m new file mode 100644 index 00000000..6aea93b0 --- /dev/null +++ b/its/plugin/projects/AFNetworking/Tests/Tests/AFUIButtonTests.m @@ -0,0 +1,115 @@ +// AFUIButtonTests.h +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import +#import "AFTestCase.h" +#import "UIButton+AFNetworking.h" +#import "AFImageDownloader.h" + +@interface AFUIButtonTests : AFTestCase +@property (nonatomic, strong) UIImage *cachedImage; +@property (nonatomic, strong) NSURLRequest *cachedImageRequest; +@property (nonatomic, strong) UIButton *button; + +@property (nonatomic, strong) NSURL *error404URL; +@property (nonatomic, strong) NSURLRequest *error404URLRequest; + +@property (nonatomic, strong) NSURL *jpegURL; +@property (nonatomic, strong) NSURLRequest *jpegURLRequest; +@end + +@implementation AFUIButtonTests + +- (void)setUp { + [super setUp]; + [[UIButton sharedImageDownloader].imageCache removeAllImages]; + [[[[[[UIButton sharedImageDownloader] sessionManager] session] configuration] URLCache] removeAllCachedResponses]; + [UIButton setSharedImageDownloader:[[AFImageDownloader alloc] init]]; + + self.button = [UIButton new]; + + self.jpegURL = [NSURL URLWithString:@"https://httpbin.org/image/jpeg"]; + self.jpegURLRequest = [NSURLRequest requestWithURL:self.jpegURL]; + + self.error404URL = [NSURL URLWithString:@"https://httpbin.org/status/404"]; + self.error404URLRequest = [NSURLRequest requestWithURL:self.error404URL]; + +} + +- (void)tearDown { + self.button = nil; + [super tearDown]; + +} + +- (void)testThatBackgroundImageChanges { + XCTAssertNil([self.button backgroundImageForState:UIControlStateNormal]); + [self.button setBackgroundImageForState:UIControlStateNormal withURL:self.jpegURL]; + NSPredicate *predicate = [NSPredicate predicateWithBlock:^BOOL(UIButton * _Nonnull button, NSDictionary * _Nullable bindings) { + return [button backgroundImageForState:UIControlStateNormal] != nil; + }]; + + [self expectationForPredicate:predicate + evaluatedWithObject:self.button + handler:nil]; + + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +- (void)testThatForegroundImageCanBeCancelledAndDownloadedImmediately { + //https://github.com/Alamofire/AlamofireImage/issues/55 + XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"]; + [self.button setImageForState:UIControlStateNormal withURL:self.jpegURL]; + [self.button cancelImageDownloadTaskForState:UIControlStateNormal]; + __block UIImage *responseImage; + [self.button + setImageForState:UIControlStateNormal + withURLRequest:self.jpegURLRequest + placeholderImage:nil + success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull image) { + responseImage = image; + [expectation fulfill]; + } + failure:nil]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + XCTAssertNotNil(responseImage); +} + +- (void)testThatBackgroundImageCanBeCancelledAndDownloadedImmediately { + //https://github.com/Alamofire/AlamofireImage/issues/55 + XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"]; + [self.button setBackgroundImageForState:UIControlStateNormal withURL:self.jpegURL]; + [self.button cancelBackgroundImageDownloadTaskForState:UIControlStateNormal]; + __block UIImage *responseImage; + [self.button + setBackgroundImageForState:UIControlStateNormal + withURLRequest:self.jpegURLRequest + placeholderImage:nil + success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull image) { + responseImage = image; + [expectation fulfill]; + } + failure:nil]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + XCTAssertNotNil(responseImage); +} + +@end diff --git a/its/plugin/projects/AFNetworking/Tests/Tests/AFUIImageViewTests.m b/its/plugin/projects/AFNetworking/Tests/Tests/AFUIImageViewTests.m new file mode 100644 index 00000000..9261fc5c --- /dev/null +++ b/its/plugin/projects/AFNetworking/Tests/Tests/AFUIImageViewTests.m @@ -0,0 +1,155 @@ +// AFUIImageViewTests.h +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "AFTestCase.h" +#import "UIImageView+AFNetworking.h" +#import "AFImageDownloader.h" + +@interface AFUIImageViewTests : AFTestCase +@property (nonatomic, strong) UIImage *cachedImage; +@property (nonatomic, strong) NSURLRequest *cachedImageRequest; +@property (nonatomic, strong) UIImageView *imageView; + +@property (nonatomic, strong) NSURL *error404URL; +@property (nonatomic, strong) NSURLRequest *error404URLRequest; + +@property (nonatomic, strong) NSURL *jpegURL; +@property (nonatomic, strong) NSURLRequest *jpegURLRequest; + +@end + +@implementation AFUIImageViewTests + +- (void)setUp { + [super setUp]; + [[UIImageView sharedImageDownloader].imageCache removeAllImages]; + [[[[[[UIImageView sharedImageDownloader] sessionManager] session] configuration] URLCache] removeAllCachedResponses]; + [UIImageView setSharedImageDownloader:[[AFImageDownloader alloc] init]]; + + self.imageView = [UIImageView new]; + + self.jpegURL = [NSURL URLWithString:@"https://httpbin.org/image/jpeg"]; + self.jpegURLRequest = [NSURLRequest requestWithURL:self.jpegURL]; + + self.error404URL = [NSURL URLWithString:@"https://httpbin.org/status/404"]; + self.error404URLRequest = [NSURLRequest requestWithURL:self.error404URL]; + +} + +- (void)tearDown { + self.imageView = nil; + [super tearDown]; + +} + +- (void)testThatImageCanBeDownloadedFromURL { + XCTAssertNil(self.imageView.image); + [self.imageView setImageWithURL:self.jpegURL]; + [self expectationForPredicate:[NSPredicate predicateWithFormat:@"image != nil"] + evaluatedWithObject:self.imageView + handler:nil]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +- (void)testThatImageDownloadSucceedsWhenDuplicateRequestIsSentToImageView { + XCTAssertNil(self.imageView.image); + [self.imageView setImageWithURL:self.jpegURL]; + [self.imageView setImageWithURL:self.jpegURL]; + [self expectationForPredicate:[NSPredicate predicateWithFormat:@"image != nil"] + evaluatedWithObject:self.imageView + handler:nil]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +- (void)testThatPlaceholderImageIsSetIfRequestFails { + UIImage *placeholder = [UIImage imageNamed:@"logo"]; + XCTestExpectation *expectation = [self expectationWithDescription:@"Request should fail"]; + + [self.imageView setImageWithURLRequest:self.error404URLRequest + placeholderImage:placeholder + success:nil + failure:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, NSError * _Nonnull error) { + [expectation fulfill]; + }]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + XCTAssertEqual(self.imageView.image, placeholder); +} + +- (void)testResponseIsNilWhenLoadedFromCache { + AFImageDownloader *downloader = [UIImageView sharedImageDownloader]; + XCTestExpectation *cacheExpectation = [self expectationWithDescription:@"Cache request should succeed"]; + __block UIImage *downloadImage = nil; + [downloader + downloadImageForURLRequest:self.jpegURLRequest + success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) { + downloadImage = responseObject; + [cacheExpectation fulfill]; + } + failure:nil]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + + __block UIImage *cachedImage = nil; + __block NSHTTPURLResponse *urlResponse; + XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"]; + [self.imageView + setImageWithURLRequest:self.jpegURLRequest + placeholderImage:nil + success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull image) { + urlResponse = response; + cachedImage = image; + [expectation fulfill]; + } + failure:nil]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + XCTAssertNil(urlResponse); + XCTAssertNotNil(cachedImage); + XCTAssertEqual(cachedImage, downloadImage); +} + +- (void)testThatImageCanBeCancelledAndDownloadedImmediately { + //https://github.com/Alamofire/AlamofireImage/issues/55 + XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"]; + [self.imageView setImageWithURL:self.jpegURL]; + [self.imageView cancelImageDownloadTask]; + __block UIImage *responseImage; + [self.imageView + setImageWithURLRequest:self.jpegURLRequest + placeholderImage:nil + success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull image) { + responseImage = image; + [expectation fulfill]; + } + failure:nil]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + XCTAssertNotNil(responseImage); +} + +- (void)testThatNilURLDoesntCrash { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wnonnull" + [self.imageView setImageWithURL:nil]; +#pragma clang diagnostic pop + +} + + + +@end diff --git a/its/plugin/projects/AFNetworking/Tests/Tests/AFUIRefreshControlTests.m b/its/plugin/projects/AFNetworking/Tests/Tests/AFUIRefreshControlTests.m new file mode 100644 index 00000000..6459fc1b --- /dev/null +++ b/its/plugin/projects/AFNetworking/Tests/Tests/AFUIRefreshControlTests.m @@ -0,0 +1,110 @@ +// AFUIRefreshControlTests.h +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "AFTestCase.h" +#import "UIRefreshControl+AFNetworking.h" +#import "AFURLSessionManager.h" + +@interface AFUIRefreshControlTests : AFTestCase +@property (nonatomic, strong) NSURLRequest *request; +@property (nonatomic, strong) UIRefreshControl *refreshControl; +@property (nonatomic, strong) AFURLSessionManager *sessionManager; +@end + +@implementation AFUIRefreshControlTests + +- (void)setUp { + [super setUp]; + self.refreshControl = [[UIRefreshControl alloc] init]; + self.request = [NSURLRequest requestWithURL:[self.baseURL URLByAppendingPathComponent:@"delay/1"]]; + self.sessionManager = [[AFURLSessionManager alloc] initWithSessionConfiguration:nil]; +} + +- (void)tearDown { + [super tearDown]; + [self.sessionManager invalidateSessionCancelingTasks:YES]; + self.sessionManager = nil; +} + +- (void)testTaskDidResumeNotificationDoesNotCauseCrashForUIRCWithTask { + XCTestExpectation *expectation = [self expectationWithDescription:@"No Crash"]; + [self expectationForNotification:AFNetworkingTaskDidResumeNotification object:nil handler:nil]; + NSURLSessionDataTask *task = [self.sessionManager + dataTaskWithRequest:self.request + completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) { + [expectation fulfill]; + }]; + + [self.refreshControl setRefreshingWithStateOfTask:task]; + self.refreshControl = nil; + + [task resume]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + [task cancel]; +} + +- (void)testTaskDidCompleteNotificationDoesNotCauseCrashForUIRCWithTask { + XCTestExpectation *expectation = [self expectationWithDescription:@"No Crash"]; + [self expectationForNotification:AFNetworkingTaskDidCompleteNotification object:nil handler:nil]; + NSURLSessionDataTask *task = [self.sessionManager + dataTaskWithRequest:self.request + completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) { + //Without the dispatch after, this test would PASS errorenously because the test + //would finish before the notification was posted to all objects that were + //observing it. + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [expectation fulfill]; + }); + }]; + + [self.refreshControl setRefreshingWithStateOfTask:task]; + self.refreshControl = nil; + + [task resume]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + [task cancel]; +} + +- (void)testTaskDidSuspendNotificationDoesNotCauseCrashForUIRCWithTask { + XCTestExpectation *expectation = [self expectationWithDescription:@"No Crash"]; + [self expectationForNotification:AFNetworkingTaskDidSuspendNotification object:nil handler:nil]; + NSURLSessionDataTask *task = [self.sessionManager + dataTaskWithRequest:self.request + completionHandler:^(NSURLResponse *response, id responseObject, NSError *error) { + //Without the dispatch after, this test would PASS errorenously because the test + //would finish before the notification was posted to all objects that were + //observing it. + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ + [expectation fulfill]; + }); + }]; + + [self.refreshControl setRefreshingWithStateOfTask:task]; + self.refreshControl = nil; + + [task resume]; + [task suspend]; + [task resume]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; + [task cancel]; +} + +@end diff --git a/its/plugin/projects/AFNetworking/Tests/Tests/AFUIWebViewTests.m b/its/plugin/projects/AFNetworking/Tests/Tests/AFUIWebViewTests.m new file mode 100644 index 00000000..c43b3f90 --- /dev/null +++ b/its/plugin/projects/AFNetworking/Tests/Tests/AFUIWebViewTests.m @@ -0,0 +1,85 @@ +// AFUIWebViewTests.h +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import +#import "AFTestCase.h" +#import "UIWebView+AFNetworking.h" + +@interface AFUIWebViewTests : AFTestCase +@property (nonatomic, strong) UIWebView *webView; +@property (nonatomic, strong) NSURLRequest *HTMLRequest; + +@end + +@implementation AFUIWebViewTests + +- (void)setUp { + [super setUp]; + self.webView = [UIWebView new]; + self.HTMLRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"https://httpbin.org/html"]]; +} + +- (void)testNilProgressDoesNotCauseCrash { + XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"]; + [self.webView + loadRequest:self.HTMLRequest + progress:nil + success:^NSString * _Nonnull(NSHTTPURLResponse * _Nonnull response, NSString * _Nonnull HTML) { + [expectation fulfill]; + return HTML; + } + failure:nil]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +- (void)testNULLProgressDoesNotCauseCrash { + XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"]; + [self.webView + loadRequest:self.HTMLRequest + progress:NULL + success:^NSString * _Nonnull(NSHTTPURLResponse * _Nonnull response, NSString * _Nonnull HTML) { + [expectation fulfill]; + return HTML; + } + failure:nil]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +- (void)testProgressIsSet { + NSProgress* progress = nil; + XCTestExpectation *expectation = [self expectationWithDescription:@"Request should succeed"]; + [self.webView + loadRequest:self.HTMLRequest + progress:&progress + success:^NSString * _Nonnull(NSHTTPURLResponse * _Nonnull response, NSString * _Nonnull HTML) { + [expectation fulfill]; + return HTML; + } + failure:nil]; + [self keyValueObservingExpectationForObject:progress + keyPath:@"fractionCompleted" + expectedValue:@(1.0)]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + + + +@end diff --git a/its/plugin/projects/AFNetworking/Tests/Tests/AFURLSessionManagerTests.m b/its/plugin/projects/AFNetworking/Tests/Tests/AFURLSessionManagerTests.m new file mode 100644 index 00000000..b239267e --- /dev/null +++ b/its/plugin/projects/AFNetworking/Tests/Tests/AFURLSessionManagerTests.m @@ -0,0 +1,473 @@ +// AFURLSessionManagerTests.m +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import + +#import "AFTestCase.h" + +#import "AFURLSessionManager.h" + +@interface AFURLSessionManagerTests : AFTestCase +@property (readwrite, nonatomic, strong) AFURLSessionManager *localManager; +@property (readwrite, nonatomic, strong) AFURLSessionManager *backgroundManager; +@end + + +@implementation AFURLSessionManagerTests + +- (NSURLRequest *)bigImageURLRequest { + NSURL *url = [NSURL URLWithString:@"http://scitechdaily.com/images/New-Image-of-the-Galaxy-Messier-94-also-Known-as-NGC-4736.jpg"]; + NSURLRequest *request = [[NSURLRequest alloc] initWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:60.0]; + return request; +} + +- (void)setUp { + [super setUp]; + self.localManager = [[AFURLSessionManager alloc] init]; + [self.localManager.session.configuration.URLCache removeAllCachedResponses]; + + //Unfortunately, iOS 7 throws an exception when trying to create a background URL Session inside this test target, which means our tests here can only run on iOS 8+ + //Travis actually needs the try catch here. Just doing if ([NSURLSessionConfiguration respondsToSelector:@selector(backgroundSessionWithIdentifier)]) wasn't good enough. + @try { + NSString *identifier = [NSString stringWithFormat:@"com.afnetworking.tests.urlsession.%@", [[NSUUID UUID] UUIDString]]; + NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:identifier]; + self.backgroundManager = [[AFURLSessionManager alloc] initWithSessionConfiguration:configuration]; + } + @catch (NSException *exception) { + + } +} + +- (void)tearDown { + [super tearDown]; + [self.localManager.session.configuration.URLCache removeAllCachedResponses]; + [self.localManager invalidateSessionCancelingTasks:YES]; + self.localManager = nil; + + [self.backgroundManager invalidateSessionCancelingTasks:YES]; + self.backgroundManager = nil; +} + +#pragma mark Progress - + +- (void)testDataTaskDoesReportDownloadProgress { + NSURLSessionDataTask *task; + + __weak XCTestExpectation *expectation = [self expectationWithDescription:@"Progress should equal 1.0"]; + task = [self.localManager + dataTaskWithRequest:[self bigImageURLRequest] + uploadProgress:nil + downloadProgress:^(NSProgress * _Nonnull downloadProgress) { + if (downloadProgress.fractionCompleted == 1.0) { + [expectation fulfill]; + } + } + completionHandler:nil]; + + [task resume]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +- (void)testDataTaskDownloadProgressCanBeKVOd { + NSURLSessionDataTask *task; + + task = [self.localManager + dataTaskWithRequest:[self bigImageURLRequest] + uploadProgress:nil + downloadProgress:nil + completionHandler:nil]; + + NSProgress *progress = [self.localManager downloadProgressForTask:task]; + [self keyValueObservingExpectationForObject:progress keyPath:@"fractionCompleted" + handler:^BOOL(NSProgress *observedProgress, NSDictionary * _Nonnull change) { + double new = [change[@"new"] doubleValue]; + double old = [change[@"old"] doubleValue]; + return new == 1.0 && old != 0.0; + }]; + [task resume]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +- (void)testDownloadTaskDoesReportProgress { + __weak XCTestExpectation *expectation = [self expectationWithDescription:@"Progress should equal 1.0"]; + NSURLSessionTask *task; + task = [self.localManager + downloadTaskWithRequest:[self bigImageURLRequest] + progress:^(NSProgress * _Nonnull downloadProgress) { + if (downloadProgress.fractionCompleted == 1.0) { + [expectation fulfill]; + } + } + destination:nil + completionHandler:nil]; + [task resume]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +- (void)testUploadTaskDoesReportProgress { + NSMutableString *payload = [NSMutableString stringWithString:@"AFNetworking"]; + while ([payload lengthOfBytesUsingEncoding:NSUTF8StringEncoding] < 20000) { + [payload appendString:@"AFNetworking"]; + } + + NSURL *url = [NSURL URLWithString:[[self.baseURL absoluteString] stringByAppendingString:@"/post"]]; + NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:60.0]; + [request setHTTPMethod:@"POST"]; + + __weak XCTestExpectation *expectation = [self expectationWithDescription:@"Progress should equal 1.0"]; + + NSURLSessionTask *task; + task = [self.localManager + uploadTaskWithRequest:request + fromData:[payload dataUsingEncoding:NSUTF8StringEncoding] + progress:^(NSProgress * _Nonnull uploadProgress) { + NSLog(@"%@", uploadProgress.localizedDescription); + if ([uploadProgress fractionCompleted] == 1.0) { + [expectation fulfill]; + } + } + completionHandler:nil]; + [task resume]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +- (void)testUploadProgressCanBeKVOd { + NSMutableString *payload = [NSMutableString stringWithString:@"AFNetworking"]; + while ([payload lengthOfBytesUsingEncoding:NSUTF8StringEncoding] < 20000) { + [payload appendString:@"AFNetworking"]; + } + + NSURL *url = [NSURL URLWithString:[[self.baseURL absoluteString] stringByAppendingString:@"/post"]]; + NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringCacheData timeoutInterval:60.0]; + [request setHTTPMethod:@"POST"]; + + NSURLSessionTask *task; + task = [self.localManager + uploadTaskWithRequest:request + fromData:[payload dataUsingEncoding:NSUTF8StringEncoding] + progress:nil + completionHandler:nil]; + + NSProgress *uploadProgress = [self.localManager uploadProgressForTask:task]; + [self keyValueObservingExpectationForObject:uploadProgress keyPath:NSStringFromSelector(@selector(fractionCompleted)) expectedValue:@(1.0)]; + + [task resume]; + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +#pragma mark - rdar://17029580 + +- (void)testRDAR17029580IsFixed { + //https://github.com/AFNetworking/AFNetworking/issues/2093 + //https://github.com/AFNetworking/AFNetworking/pull/3205 + //http://openradar.appspot.com/radar?id=5871104061079552 + dispatch_queue_t serial_queue = dispatch_queue_create("com.alamofire.networking.test.RDAR17029580", DISPATCH_QUEUE_SERIAL); + NSMutableArray *taskIDs = [[NSMutableArray alloc] init]; + for (NSInteger i = 0; i < 100; i++) { + XCTestExpectation *expectation = [self expectationWithDescription:@"Wait for task creation"]; + __block NSURLSessionTask *task; + dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ + task = [self.localManager + dataTaskWithRequest:[NSURLRequest requestWithURL:self.baseURL] + completionHandler:nil]; + dispatch_sync(serial_queue, ^{ + XCTAssertFalse([taskIDs containsObject:@(task.taskIdentifier)]); + [taskIDs addObject:@(task.taskIdentifier)]; + }); + [task cancel]; + [expectation fulfill]; + }); + } + [self waitForExpectationsWithCommonTimeoutUsingHandler:nil]; +} + +#pragma mark - Issue #2702 Tests +// The following tests are all releated to issue #2702 + +- (void)testDidResumeNotificationIsReceivedByLocalDataTaskAfterResume { + NSURLSessionDataTask *task = [self.localManager dataTaskWithRequest:[self _delayURLRequest] + completionHandler:nil]; + [self _testResumeNotificationForTask:task]; +} + +- (void)testDidSuspendNotificationIsReceivedByLocalDataTaskAfterSuspend { + NSURLSessionDataTask *task = [self.localManager dataTaskWithRequest:[self _delayURLRequest] + completionHandler:nil]; + [self _testSuspendNotificationForTask:task]; +} + +- (void)testDidResumeNotificationIsReceivedByBackgroundDataTaskAfterResume { + if (self.backgroundManager) { + NSURLSessionDataTask *task = [self.backgroundManager dataTaskWithRequest:[self _delayURLRequest] + completionHandler:nil]; + [self _testResumeNotificationForTask:task]; + } +} + +- (void)testDidSuspendNotificationIsReceivedByBackgroundDataTaskAfterSuspend { + if (self.backgroundManager) { + NSURLSessionDataTask *task = [self.backgroundManager dataTaskWithRequest:[self _delayURLRequest] + completionHandler:nil]; + [self _testSuspendNotificationForTask:task]; + } +} + +- (void)testDidResumeNotificationIsReceivedByLocalUploadTaskAfterResume { + NSURLSessionUploadTask *task = [self.localManager uploadTaskWithRequest:[self _delayURLRequest] + fromData:[NSData data] + progress:nil + completionHandler:nil]; + [self _testResumeNotificationForTask:task]; +} + +- (void)testDidSuspendNotificationIsReceivedByLocalUploadTaskAfterSuspend { + NSURLSessionUploadTask *task = [self.localManager uploadTaskWithRequest:[self _delayURLRequest] + fromData:[NSData data] + progress:nil + completionHandler:nil]; + [self _testSuspendNotificationForTask:task]; +} + +- (void)testDidResumeNotificationIsReceivedByBackgroundUploadTaskAfterResume { + if (self.backgroundManager) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wnonnull" + NSURLSessionUploadTask *task = [self.backgroundManager uploadTaskWithRequest:[self _delayURLRequest] + fromFile:nil + progress:nil + completionHandler:nil]; +#pragma clang diagnostic pop + [self _testResumeNotificationForTask:task]; + } +} + +- (void)testDidSuspendNotificationIsReceivedByBackgroundUploadTaskAfterSuspend { + if (self.backgroundManager) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wnonnull" + NSURLSessionUploadTask *task = [self.backgroundManager uploadTaskWithRequest:[self _delayURLRequest] + fromFile:nil + progress:nil + completionHandler:nil]; +#pragma clang diagnostic pop + [self _testSuspendNotificationForTask:task]; + } +} + +- (void)testDidResumeNotificationIsReceivedByLocalDownloadTaskAfterResume { + NSURLSessionDownloadTask *task = [self.localManager downloadTaskWithRequest:[self _delayURLRequest] + progress:nil + destination:nil + completionHandler:nil]; + [self _testResumeNotificationForTask:task]; +} + +- (void)testDidSuspendNotificationIsReceivedByLocalDownloadTaskAfterSuspend { + NSURLSessionDownloadTask *task = [self.localManager downloadTaskWithRequest:[self _delayURLRequest] + progress:nil + destination:nil + completionHandler:nil]; + [self _testSuspendNotificationForTask:task]; +} + +- (void)testDidResumeNotificationIsReceivedByBackgroundDownloadTaskAfterResume { + if (self.backgroundManager) { + NSURLSessionDownloadTask *task = [self.backgroundManager downloadTaskWithRequest:[self _delayURLRequest] + progress:nil + destination:nil + completionHandler:nil]; + [self _testResumeNotificationForTask:task]; + } +} + +- (void)testDidSuspendNotificationIsReceivedByBackgroundDownloadTaskAfterSuspend { + if (self.backgroundManager) { + NSURLSessionDownloadTask *task = [self.backgroundManager downloadTaskWithRequest:[self _delayURLRequest] + progress:nil + destination:nil + completionHandler:nil]; + [self _testSuspendNotificationForTask:task]; + } +} + +- (void)testSwizzlingIsProperlyConfiguredForDummyClass { + IMP originalAFResumeIMP = [self _originalAFResumeImplementation]; + IMP originalAFSuspendIMP = [self _originalAFSuspendImplementation]; + XCTAssert(originalAFResumeIMP, @"Swizzled af_resume Method Not Found"); + XCTAssert(originalAFSuspendIMP, @"Swizzled af_suspend Method Not Found"); + XCTAssertNotEqual(originalAFResumeIMP, originalAFSuspendIMP, @"af_resume and af_suspend should not be equal"); +} + +- (void)testSwizzlingIsWorkingAsExpectedForForegroundDataTask { + NSURLSessionTask *task = [self.localManager dataTaskWithRequest:[self _delayURLRequest] + completionHandler:nil]; + [self _testSwizzlingForTask:task]; + [task cancel]; +} + +- (void)testSwizzlingIsWorkingAsExpectedForForegroundUpload { + NSURLSessionTask *task = [self.localManager uploadTaskWithRequest:[self _delayURLRequest] + fromData:[NSData data] + progress:nil + completionHandler:nil]; + [self _testSwizzlingForTask:task]; + [task cancel]; +} + +- (void)testSwizzlingIsWorkingAsExpectedForForegroundDownload { + NSURLSessionTask *task = [self.localManager downloadTaskWithRequest:[self _delayURLRequest] + progress:nil + destination:nil + completionHandler:nil]; + [self _testSwizzlingForTask:task]; + [task cancel]; +} + +- (void)testSwizzlingIsWorkingAsExpectedForBackgroundDataTask { + //iOS 7 doesn't let us use a background manager in these tests, so reference these + //classes directly. There are tests below to confirm background manager continues + //to return the exepcted classes going forward. If those fail in a future iOS version, + //it should point us to a problem here. + [self _testSwizzlingForTaskClass:NSClassFromString(@"__NSCFBackgroundDataTask")]; +} + +- (void)testSwizzlingIsWorkingAsExpectedForBackgroundUploadTask { + //iOS 7 doesn't let us use a background manager in these tests, so reference these + //classes directly. There are tests below to confirm background manager continues + //to return the exepcted classes going forward. If those fail in a future iOS version, + //it should point us to a problem here. + [self _testSwizzlingForTaskClass:NSClassFromString(@"__NSCFBackgroundUploadTask")]; +} + +- (void)testSwizzlingIsWorkingAsExpectedForBackgroundDownloadTask { + //iOS 7 doesn't let us use a background manager in these tests, so reference these + //classes directly. There are tests below to confirm background manager continues + //to return the exepcted classes going forward. If those fail in a future iOS version, + //it should point us to a problem here. + [self _testSwizzlingForTaskClass:NSClassFromString(@"__NSCFBackgroundDownloadTask")]; +} + +- (void)testBackgroundManagerReturnsExpectedClassForDataTask { + if (self.backgroundManager) { + NSURLSessionTask *task = [self.backgroundManager dataTaskWithRequest:[self _delayURLRequest] + completionHandler:nil]; + XCTAssert([NSStringFromClass([task class]) isEqualToString:@"__NSCFBackgroundDataTask"]); + } else { + NSLog(@"Unable to run %@ because self.backgroundManager is nil", NSStringFromSelector(_cmd)); + } +} + +- (void)testBackgroundManagerReturnsExpectedClassForUploadTask { + if (self.backgroundManager) { +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wnonnull" + NSURLSessionTask *task = [self.backgroundManager uploadTaskWithRequest:[self _delayURLRequest] + fromFile:nil + progress:nil + completionHandler:nil]; +#pragma clang diagnostic pop + XCTAssert([NSStringFromClass([task class]) isEqualToString:@"__NSCFBackgroundUploadTask"]); + } else { + NSLog(@"Unable to run %@ because self.backgroundManager is nil", NSStringFromSelector(_cmd)); + } +} + +- (void)testBackgroundManagerReturnsExpectedClassForDownloadTask { + if (self.backgroundManager) { + NSURLSessionTask *task = [self.backgroundManager downloadTaskWithRequest:[self _delayURLRequest] + progress:nil + destination:nil + completionHandler:nil]; + XCTAssert([NSStringFromClass([task class]) isEqualToString:@"__NSCFBackgroundDownloadTask"]); + } else { + NSLog(@"Unable to run %@ because self.backgroundManager is nil", NSStringFromSelector(_cmd)); + } +} + +#pragma mark - private + +- (void)_testResumeNotificationForTask:(NSURLSessionTask *)task { + [self expectationForNotification:AFNetworkingTaskDidResumeNotification + object:nil + handler:nil]; + [task resume]; + [task suspend]; + [task resume]; + [self waitForExpectationsWithTimeout:2.0 handler:nil]; + [task cancel]; +} + +- (void)_testSuspendNotificationForTask:(NSURLSessionTask *)task { + [self expectationForNotification:AFNetworkingTaskDidSuspendNotification + object:nil + handler:nil]; + [task resume]; + [task suspend]; + [task resume]; + [self waitForExpectationsWithTimeout:2.0 handler:nil]; + [task cancel]; +} + +- (NSURLRequest *)_delayURLRequest { + return [NSURLRequest requestWithURL:[self.baseURL URLByAppendingPathComponent:@"delay/1"]]; +} + +- (IMP)_implementationForTask:(NSURLSessionTask *)task selector:(SEL)selector { + return [self _implementationForClass:[task class] selector:selector]; +} + +- (IMP)_implementationForClass:(Class)class selector:(SEL)selector { + return method_getImplementation(class_getInstanceMethod(class, selector)); +} + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wundeclared-selector" +- (IMP)_originalAFResumeImplementation { + return method_getImplementation(class_getInstanceMethod(NSClassFromString(@"_AFURLSessionTaskSwizzling"), @selector(af_resume))); +} + +- (IMP)_originalAFSuspendImplementation { + return method_getImplementation(class_getInstanceMethod(NSClassFromString(@"_AFURLSessionTaskSwizzling"), @selector(af_suspend))); +} + +- (void)_testSwizzlingForTask:(NSURLSessionTask *)task { + [self _testSwizzlingForTaskClass:[task class]]; +} + +- (void)_testSwizzlingForTaskClass:(Class)class { + IMP originalAFResumeIMP = [self _originalAFResumeImplementation]; + IMP originalAFSuspendIMP = [self _originalAFSuspendImplementation]; + + IMP taskResumeImp = [self _implementationForClass:class selector:@selector(resume)]; + IMP taskSuspendImp = [self _implementationForClass:class selector:@selector(suspend)]; + XCTAssertEqual(originalAFResumeIMP, taskResumeImp, @"resume has not been properly swizzled for %@", NSStringFromClass(class)); + XCTAssertEqual(originalAFSuspendIMP, taskSuspendImp, @"suspend has not been properly swizzled for %@", NSStringFromClass(class)); + + IMP taskAFResumeImp = [self _implementationForClass:class selector:@selector(af_resume)]; + IMP taskAFSuspendImp = [self _implementationForClass:class selector:@selector(af_suspend)]; + XCTAssert(taskAFResumeImp != NULL, @"af_resume is nil. Something has not been been swizzled right for %@", NSStringFromClass(class)); + XCTAssertNotEqual(taskAFResumeImp, taskResumeImp, @"af_resume has not been properly swizzled for %@", NSStringFromClass(class)); + XCTAssert(taskAFSuspendImp != NULL, @"af_suspend is nil. Something has not been been swizzled right for %@", NSStringFromClass(class)); + XCTAssertNotEqual(taskAFSuspendImp, taskSuspendImp, @"af_suspend has not been properly swizzled for %@", NSStringFromClass(class)); +} +#pragma clang diagnostic pop + +@end diff --git a/its/plugin/projects/AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.h b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.h new file mode 100644 index 00000000..16139dad --- /dev/null +++ b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.h @@ -0,0 +1,149 @@ +// AFAutoPurgingImageCache.h +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import +#import + +#if TARGET_OS_IOS || TARGET_OS_TV +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + The `AFImageCache` protocol defines a set of APIs for adding, removing and fetching images from a cache synchronously. + */ +@protocol AFImageCache + +/** + Adds the image to the cache with the given identifier. + + @param image The image to cache. + @param identifier The unique identifier for the image in the cache. + */ +- (void)addImage:(UIImage *)image withIdentifier:(NSString *)identifier; + +/** + Removes the image from the cache matching the given identifier. + + @param identifier The unique identifier for the image in the cache. + + @return A BOOL indicating whether or not the image was removed from the cache. + */ +- (BOOL)removeImageWithIdentifier:(NSString *)identifier; + +/** + Removes all images from the cache. + + @return A BOOL indicating whether or not all images were removed from the cache. + */ +- (BOOL)removeAllImages; + +/** + Returns the image in the cache associated with the given identifier. + + @param identifier The unique identifier for the image in the cache. + + @return An image for the matching identifier, or nil. + */ +- (nullable UIImage *)imageWithIdentifier:(NSString *)identifier; +@end + + +/** + The `ImageRequestCache` protocol extends the `ImageCache` protocol by adding methods for adding, removing and fetching images from a cache given an `NSURLRequest` and additional identifier. + */ +@protocol AFImageRequestCache + +/** + Adds the image to the cache using an identifier created from the request and additional identifier. + + @param image The image to cache. + @param request The unique URL request identifing the image asset. + @param identifier The additional identifier to apply to the URL request to identify the image. + */ +- (void)addImage:(UIImage *)image forRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier; + +/** + Removes the image from the cache using an identifier created from the request and additional identifier. + + @param request The unique URL request identifing the image asset. + @param identifier The additional identifier to apply to the URL request to identify the image. + + @return A BOOL indicating whether or not all images were removed from the cache. + */ +- (BOOL)removeImageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier; + +/** + Returns the image from the cache associated with an identifier created from the request and additional identifier. + + @param request The unique URL request identifing the image asset. + @param identifier The additional identifier to apply to the URL request to identify the image. + + @return An image for the matching request and identifier, or nil. + */ +- (nullable UIImage *)imageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(nullable NSString *)identifier; + +@end + +/** + The `AutoPurgingImageCache` in an in-memory image cache used to store images up to a given memory capacity. When the memory capacity is reached, the image cache is sorted by last access date, then the oldest image is continuously purged until the preferred memory usage after purge is met. Each time an image is accessed through the cache, the internal access date of the image is updated. + */ +@interface AFAutoPurgingImageCache : NSObject + +/** + The total memory capacity of the cache in bytes. + */ +@property (nonatomic, assign) UInt64 memoryCapacity; + +/** + The preferred memory usage after purge in bytes. During a purge, images will be purged until the memory capacity drops below this limit. + */ +@property (nonatomic, assign) UInt64 preferredMemoryUsageAfterPurge; + +/** + The current total memory usage in bytes of all images stored within the cache. + */ +@property (nonatomic, assign, readonly) UInt64 memoryUsage; + +/** + Initialies the `AutoPurgingImageCache` instance with default values for memory capacity and preferred memory usage after purge limit. `memoryCapcity` defaults to `100 MB`. `preferredMemoryUsageAfterPurge` defaults to `60 MB`. + + @return The new `AutoPurgingImageCache` instance. + */ +- (instancetype)init; + +/** + Initialies the `AutoPurgingImageCache` instance with the given memory capacity and preferred memory usage + after purge limit. + + @param memoryCapacity The total memory capacity of the cache in bytes. + @param preferredMemoryUsageAfterPurge The preferred memory usage after purge in bytes. + + @return The new `AutoPurgingImageCache` instance. + */ +- (instancetype)initWithMemoryCapacity:(UInt64)memoryCapacity preferredMemoryCapacity:(UInt64)preferredMemoryCapacity; + +@end + +NS_ASSUME_NONNULL_END + +#endif + diff --git a/its/plugin/projects/AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.m b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.m new file mode 100644 index 00000000..99ad3d65 --- /dev/null +++ b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/AFAutoPurgingImageCache.m @@ -0,0 +1,201 @@ +// AFAutoPurgingImageCache.m +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import + +#if TARGET_OS_IOS || TARGET_OS_TV + +#import "AFAutoPurgingImageCache.h" + +@interface AFCachedImage : NSObject + +@property (nonatomic, strong) UIImage *image; +@property (nonatomic, strong) NSString *identifier; +@property (nonatomic, assign) UInt64 totalBytes; +@property (nonatomic, strong) NSDate *lastAccessDate; +@property (nonatomic, assign) UInt64 currentMemoryUsage; + +@end + +@implementation AFCachedImage + +-(instancetype)initWithImage:(UIImage *)image identifier:(NSString *)identifier { + if (self = [self init]) { + self.image = image; + self.identifier = identifier; + + CGSize imageSize = CGSizeMake(image.size.width * image.scale, image.size.height * image.scale); + CGFloat bytesPerPixel = 4.0; + CGFloat bytesPerRow = imageSize.width * bytesPerPixel; + self.totalBytes = (UInt64)bytesPerPixel * (UInt64)bytesPerRow; + self.lastAccessDate = [NSDate date]; + } + return self; +} + +- (UIImage*)accessImage { + self.lastAccessDate = [NSDate date]; + return self.image; +} + +- (NSString *)description { + NSString *descriptionString = [NSString stringWithFormat:@"Idenfitier: %@ lastAccessDate: %@ ", self.identifier, self.lastAccessDate]; + return descriptionString; + +} + +@end + +@interface AFAutoPurgingImageCache () +@property (nonatomic, strong) NSMutableDictionary *cachedImages; +@property (nonatomic, assign) UInt64 currentMemoryUsage; +@property (nonatomic, strong) dispatch_queue_t synchronizationQueue; +@end + +@implementation AFAutoPurgingImageCache + +- (instancetype)init { + return [self initWithMemoryCapacity:100 * 1024 * 1024 preferredMemoryCapacity:60 * 1024 * 1024]; +} + +- (instancetype)initWithMemoryCapacity:(UInt64)memoryCapacity preferredMemoryCapacity:(UInt64)preferredMemoryCapacity { + if (self = [super init]) { + self.memoryCapacity = memoryCapacity; + self.preferredMemoryUsageAfterPurge = preferredMemoryCapacity; + self.cachedImages = [[NSMutableDictionary alloc] init]; + + NSString *queueName = [NSString stringWithFormat:@"com.alamofire.autopurgingimagecache-%@", [[NSUUID UUID] UUIDString]]; + self.synchronizationQueue = dispatch_queue_create([queueName cStringUsingEncoding:NSASCIIStringEncoding], DISPATCH_QUEUE_CONCURRENT); + + [[NSNotificationCenter defaultCenter] + addObserver:self + selector:@selector(removeAllImages) + name:UIApplicationDidReceiveMemoryWarningNotification + object:nil]; + + } + return self; +} + +- (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; +} + +- (UInt64)memoryUsage { + __block UInt64 result = 0; + dispatch_sync(self.synchronizationQueue, ^{ + result = self.currentMemoryUsage; + }); + return result; +} + +- (void)addImage:(UIImage *)image withIdentifier:(NSString *)identifier { + dispatch_barrier_async(self.synchronizationQueue, ^{ + AFCachedImage *cacheImage = [[AFCachedImage alloc] initWithImage:image identifier:identifier]; + + AFCachedImage *previousCachedImage = self.cachedImages[identifier]; + if (previousCachedImage != nil) { + self.currentMemoryUsage -= previousCachedImage.totalBytes; + } + + self.cachedImages[identifier] = cacheImage; + self.currentMemoryUsage += cacheImage.totalBytes; + }); + + dispatch_barrier_async(self.synchronizationQueue, ^{ + if (self.currentMemoryUsage > self.memoryCapacity) { + UInt64 bytesToPurge = self.currentMemoryUsage - self.preferredMemoryUsageAfterPurge; + NSMutableArray *sortedImages = [NSMutableArray arrayWithArray:self.cachedImages.allValues]; + NSSortDescriptor *sortDescriptor = [[NSSortDescriptor alloc] initWithKey:@"lastAccessDate" + ascending:YES]; + [sortedImages sortUsingDescriptors:@[sortDescriptor]]; + + UInt64 bytesPurged = 0; + + for (AFCachedImage *cachedImage in sortedImages) { + [self.cachedImages removeObjectForKey:cachedImage.identifier]; + bytesPurged += cachedImage.totalBytes; + if (bytesPurged >= bytesToPurge) { + break ; + } + } + self.currentMemoryUsage -= bytesPurged; + } + }); +} + +- (BOOL)removeImageWithIdentifier:(NSString *)identifier { + __block BOOL removed = NO; + dispatch_barrier_sync(self.synchronizationQueue, ^{ + AFCachedImage *cachedImage = self.cachedImages[identifier]; + if (cachedImage != nil) { + [self.cachedImages removeObjectForKey:identifier]; + self.currentMemoryUsage -= cachedImage.totalBytes; + removed = YES; + } + }); + return removed; +} + +- (BOOL)removeAllImages { + __block BOOL removed = NO; + dispatch_barrier_sync(self.synchronizationQueue, ^{ + if (self.cachedImages.count > 0) { + [self.cachedImages removeAllObjects]; + self.currentMemoryUsage = 0; + removed = YES; + } + }); + return removed; +} + +- (nullable UIImage *)imageWithIdentifier:(NSString *)identifier { + __block UIImage *image = nil; + dispatch_sync(self.synchronizationQueue, ^{ + AFCachedImage *cachedImage = self.cachedImages[identifier]; + image = [cachedImage accessImage]; + }); + return image; +} + +- (void)addImage:(UIImage *)image forRequest:(NSURLRequest *)request withAdditionalIdentifier:(NSString *)identifier { + [self addImage:image withIdentifier:[self imageCacheKeyFromURLRequest:request withAdditionalIdentifier:identifier]]; +} + +- (BOOL)removeImageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(NSString *)identifier { + return [self removeImageWithIdentifier:[self imageCacheKeyFromURLRequest:request withAdditionalIdentifier:identifier]]; +} + +- (nullable UIImage *)imageforRequest:(NSURLRequest *)request withAdditionalIdentifier:(NSString *)identifier { + return [self imageWithIdentifier:[self imageCacheKeyFromURLRequest:request withAdditionalIdentifier:identifier]]; +} + +- (NSString *)imageCacheKeyFromURLRequest:(NSURLRequest *)request withAdditionalIdentifier:(NSString *)additionalIdentifier { + NSString *key = request.URL.absoluteString; + if (additionalIdentifier != nil) { + key = [key stringByAppendingString:additionalIdentifier]; + } + return key; +} + +@end + +#endif diff --git a/its/plugin/projects/AFNetworking/UIKit+AFNetworking/AFImageDownloader.h b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/AFImageDownloader.h new file mode 100644 index 00000000..a368ad8f --- /dev/null +++ b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/AFImageDownloader.h @@ -0,0 +1,157 @@ +// AFImageDownloader.h +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import + +#if TARGET_OS_IOS || TARGET_OS_TV + +#import +#import "AFAutoPurgingImageCache.h" +#import "AFHTTPSessionManager.h" + +NS_ASSUME_NONNULL_BEGIN + +typedef NS_ENUM(NSInteger, AFImageDownloadPrioritization) { + AFImageDownloadPrioritizationFIFO, + AFImageDownloadPrioritizationLIFO +}; + +/** + The `AFImageDownloadReceipt` is an object vended by the `AFImageDownloader` when starting a data task. It can be used to cancel active tasks running on the `AFImageDownloader` session. As a general rule, image data tasks should be cancelled using the `AFImageDownloadReceipt` instead of calling `cancel` directly on the `task` itself. The `AFImageDownloader` is optimized to handle duplicate task scenarios as well as pending versus active downloads. + */ +@interface AFImageDownloadReceipt : NSObject + +/** + The data task created by the `AFImageDownloader`. +*/ +@property (nonatomic, strong) NSURLSessionDataTask *task; + +/** + The unique identifier for the success and failure blocks when duplicate requests are made. + */ +@property (nonatomic, strong) NSUUID *receiptID; +@end + +/** The `AFImageDownloader` class is responsible for downloading images in parallel on a prioritized queue. Incoming downloads are added to the front or back of the queue depending on the download prioritization. Each downloaded image is cached in the underlying `NSURLCache` as well as the in-memory image cache. By default, any download request with a cached image equivalent in the image cache will automatically be served the cached image representation. + */ +@interface AFImageDownloader : NSObject + +/** + The image cache used to store all downloaded images in. `AFAutoPurgingImageCache` by default. + */ +@property (nonatomic, strong, nullable) id imageCache; + +/** + The `AFHTTPSessionManager` used to download images. By default, this is configured with an `AFImageResponseSerializer`, and a shared `NSURLCache` for all image downloads. + */ +@property (nonatomic, strong) AFHTTPSessionManager *sessionManager; + +/** + Defines the order prioritization of incoming download requests being inserted into the queue. `AFImageDownloadPrioritizationFIFO` by default. + */ +@property (nonatomic, assign) AFImageDownloadPrioritization downloadPrioritizaton; + +/** + The shared default instance of `AFImageDownloader` initialized with default values. + */ ++ (instancetype)defaultInstance; + +/** + Creates a default `NSURLCache` with common usage parameter values. + + @returns The default `NSURLCache` instance. + */ ++ (NSURLCache *)defaultURLCache; + +/** + Default initializer + + @return An instance of `AFImageDownloader` initialized with default values. + */ +- (instancetype)init; + +/** + Initializes the `AFImageDownloader` instance with the given session manager, download prioritization, maximum active download count and image cache. + + @param sessionManager The session manager to use to download images. + @param downloadPrioritization The download prioritization of the download queue. + @param maximumActiveDownloads The maximum number of active downloads allowed at any given time. Recommend `4`. + @param imageCache The image cache used to store all downloaded images in. + + @return The new `AFImageDownloader` instance. + */ +- (instancetype)initWithSessionManager:(AFHTTPSessionManager *)sessionManager + downloadPrioritization:(AFImageDownloadPrioritization)downloadPrioritization + maximumActiveDownloads:(NSInteger)maximumActiveDownloads + imageCache:(nullable id )imageCache; + +/** + Creates a data task using the `sessionManager` instance for the specified URL request. + + If the same data task is already in the queue or currently being downloaded, the success and failure blocks are + appended to the already existing task. Once the task completes, all success or failure blocks attached to the + task are executed in the order they were added. + + @param request The URL request. + @param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`. + @param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred. + + @return The image download receipt for the data task if available. `nil` if the image is stored in the cache. + cache and the URL request cache policy allows the cache to be used. + */ +- (nullable AFImageDownloadReceipt *)downloadImageForURLRequest:(NSURLRequest *)request + success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *responseObject))success + failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure; + +/** + Creates a data task using the `sessionManager` instance for the specified URL request. + + If the same data task is already in the queue or currently being downloaded, the success and failure blocks are + appended to the already existing task. Once the task completes, all success or failure blocks attached to the + task are executed in the order they were added. + + @param request The URL request. + @param request The identifier to use for the download receipt that will be created for this request. This must be a unique identifier that does not represent any other request. + @param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`. + @param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred. + + @return The image download receipt for the data task if available. `nil` if the image is stored in the cache. + cache and the URL request cache policy allows the cache to be used. + */ +- (nullable AFImageDownloadReceipt *)downloadImageForURLRequest:(NSURLRequest *)request + withReceiptID:(NSUUID *)receiptID + success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *responseObject))success + failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure; + +/** + Cancels the data task in the receipt by removing the corresponding success and failure blocks and cancelling the data task if necessary. + + If the data task is pending in the queue, it will be cancelled if no other success and failure blocks are registered with the data task. If the data task is currently executing or is already completed, the success and failure blocks are removed and will not be called when the task finishes. + + @param imageDownloadReceipt The image download receipt to cancel. + */ +- (void)cancelTaskForImageDownloadReceipt:(AFImageDownloadReceipt *)imageDownloadReceipt; + +@end + +#endif + +NS_ASSUME_NONNULL_END diff --git a/its/plugin/projects/AFNetworking/UIKit+AFNetworking/AFImageDownloader.m b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/AFImageDownloader.m new file mode 100644 index 00000000..f7aa3d31 --- /dev/null +++ b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/AFImageDownloader.m @@ -0,0 +1,382 @@ +// AFImageDownloader.m +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import + +#if TARGET_OS_IOS || TARGET_OS_TV + +#import "AFImageDownloader.h" +#import "AFHTTPSessionManager.h" + +@interface AFImageDownloaderResponseHandler : NSObject +@property (nonatomic, strong) NSUUID *uuid; +@property (nonatomic, copy) void (^successBlock)(NSURLRequest*, NSHTTPURLResponse*, UIImage*); +@property (nonatomic, copy) void (^failureBlock)(NSURLRequest*, NSHTTPURLResponse*, NSError*); +@end + +@implementation AFImageDownloaderResponseHandler + +- (instancetype)initWithUUID:(NSUUID *)uuid + success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *responseObject))success + failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure { + if (self = [self init]) { + self.uuid = uuid; + self.successBlock = success; + self.failureBlock = failure; + } + return self; +} + +- (NSString *)description { + return [NSString stringWithFormat: @"UUID: %@", [self.uuid UUIDString]]; +} + +@end + +@interface AFImageDownloaderMergedTask : NSObject +@property (nonatomic, strong) NSString *URLIdentifier; +@property (nonatomic, strong) NSUUID *identifier; +@property (nonatomic, strong) NSURLSessionDataTask *task; +@property (nonatomic, strong) NSMutableArray *responseHandlers; + +@end + +@implementation AFImageDownloaderMergedTask + +- (instancetype)initWithURLIdentifier:(NSString *)URLIdentifier identifier:(NSUUID *)identifier task:(NSURLSessionDataTask *)task { + if (self = [self init]) { + self.URLIdentifier = URLIdentifier; + self.task = task; + self.identifier = identifier; + self.responseHandlers = [[NSMutableArray alloc] init]; + } + return self; +} + +- (void)addResponseHandler:(AFImageDownloaderResponseHandler*)handler { + [self.responseHandlers addObject:handler]; +} + +- (void)removeResponseHandler:(AFImageDownloaderResponseHandler*)handler { + [self.responseHandlers removeObject:handler]; +} + +@end + +@implementation AFImageDownloadReceipt + +- (instancetype)initWithReceiptID:(NSUUID *)receiptID task:(NSURLSessionDataTask *)task { + if (self = [self init]) { + self.receiptID = receiptID; + self.task = task; + } + return self; +} + +@end + +@interface AFImageDownloader () + +@property (nonatomic, strong) dispatch_queue_t synchronizationQueue; +@property (nonatomic, strong) dispatch_queue_t responseQueue; + +@property (nonatomic, assign) NSInteger maximumActiveDownloads; +@property (nonatomic, assign) NSInteger activeRequestCount; + +@property (nonatomic, strong) NSMutableArray *queuedMergedTasks; +@property (nonatomic, strong) NSMutableDictionary *mergedTasks; + +@end + + +@implementation AFImageDownloader + ++ (NSURLCache *)defaultURLCache { + return [[NSURLCache alloc] initWithMemoryCapacity:20 * 1024 * 1024 + diskCapacity:150 * 1024 * 1024 + diskPath:@"com.alamofire.imagedownloader"]; +} + ++ (NSURLSessionConfiguration *)defaultURLSessionConfiguration { + NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; + + //TODO set the default HTTP headers + + configuration.HTTPShouldSetCookies = YES; + configuration.HTTPShouldUsePipelining = NO; + + configuration.requestCachePolicy = NSURLRequestUseProtocolCachePolicy; + configuration.allowsCellularAccess = YES; + configuration.timeoutIntervalForRequest = 60.0; + configuration.URLCache = [AFImageDownloader defaultURLCache]; + + return configuration; +} + +- (instancetype)init { + NSURLSessionConfiguration *defaultConfiguration = [self.class defaultURLSessionConfiguration]; + AFHTTPSessionManager *sessionManager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:defaultConfiguration]; + sessionManager.responseSerializer = [AFImageResponseSerializer serializer]; + + return [self initWithSessionManager:sessionManager + downloadPrioritization:AFImageDownloadPrioritizationFIFO + maximumActiveDownloads:4 + imageCache:[[AFAutoPurgingImageCache alloc] init]]; +} + +- (instancetype)initWithSessionManager:(AFHTTPSessionManager *)sessionManager + downloadPrioritization:(AFImageDownloadPrioritization)downloadPrioritization + maximumActiveDownloads:(NSInteger)maximumActiveDownloads + imageCache:(id )imageCache { + if (self = [super init]) { + self.sessionManager = sessionManager; + + self.downloadPrioritizaton = downloadPrioritization; + self.maximumActiveDownloads = maximumActiveDownloads; + self.imageCache = imageCache; + + self.queuedMergedTasks = [[NSMutableArray alloc] init]; + self.mergedTasks = [[NSMutableDictionary alloc] init]; + self.activeRequestCount = 0; + + NSString *name = [NSString stringWithFormat:@"com.alamofire.imagedownloader.synchronizationqueue-%@", [[NSUUID UUID] UUIDString]]; + self.synchronizationQueue = dispatch_queue_create([name cStringUsingEncoding:NSASCIIStringEncoding], DISPATCH_QUEUE_SERIAL); + + name = [NSString stringWithFormat:@"com.alamofire.imagedownloader.responsequeue-%@", [[NSUUID UUID] UUIDString]]; + self.responseQueue = dispatch_queue_create([name cStringUsingEncoding:NSASCIIStringEncoding], DISPATCH_QUEUE_CONCURRENT); + } + + return self; +} + ++ (instancetype)defaultInstance { + static AFImageDownloader *sharedInstance = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + sharedInstance = [[self alloc] init]; + }); + return sharedInstance; +} + +- (nullable AFImageDownloadReceipt *)downloadImageForURLRequest:(NSURLRequest *)request + success:(void (^)(NSURLRequest * _Nonnull, NSHTTPURLResponse * _Nullable, UIImage * _Nonnull))success + failure:(void (^)(NSURLRequest * _Nonnull, NSHTTPURLResponse * _Nullable, NSError * _Nonnull))failure { + return [self downloadImageForURLRequest:request withReceiptID:[NSUUID UUID] success:success failure:failure]; +} + +- (nullable AFImageDownloadReceipt *)downloadImageForURLRequest:(NSURLRequest *)request + withReceiptID:(nonnull NSUUID *)receiptID + success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *responseObject))success + failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure { + __block NSURLSessionDataTask *task = nil; + dispatch_sync(self.synchronizationQueue, ^{ + NSString *URLIdentifier = request.URL.absoluteString; + + // 1) Append the success and failure blocks to a pre-existing request if it already exists + AFImageDownloaderMergedTask *existingMergedTask = self.mergedTasks[URLIdentifier]; + if (existingMergedTask != nil) { + AFImageDownloaderResponseHandler *handler = [[AFImageDownloaderResponseHandler alloc] initWithUUID:receiptID success:success failure:failure]; + [existingMergedTask addResponseHandler:handler]; + task = existingMergedTask.task; + return; + } + + // 2) Attempt to load the image from the image cache if the cache policy allows it + switch (request.cachePolicy) { + case NSURLRequestUseProtocolCachePolicy: + case NSURLRequestReturnCacheDataElseLoad: + case NSURLRequestReturnCacheDataDontLoad: { + UIImage *cachedImage = [self.imageCache imageforRequest:request withAdditionalIdentifier:nil]; + if (cachedImage != nil) { + if (success) { + dispatch_async(dispatch_get_main_queue(), ^{ + success(request, nil, cachedImage); + }); + } + return; + } + break; + } + default: + break; + } + + // 3) Create the request and set up authentication, validation and response serialization + NSUUID *mergedTaskIdentifier = [NSUUID UUID]; + NSURLSessionDataTask *createdTask; + __weak __typeof__(self) weakSelf = self; + + createdTask = [self.sessionManager + dataTaskWithRequest:request + completionHandler:^(NSURLResponse * _Nonnull response, id _Nullable responseObject, NSError * _Nullable error) { + dispatch_async(self.responseQueue, ^{ + __strong __typeof__(weakSelf) strongSelf = weakSelf; + AFImageDownloaderMergedTask *mergedTask = self.mergedTasks[URLIdentifier]; + if ([mergedTask.identifier isEqual:mergedTaskIdentifier]) { + mergedTask = [strongSelf safelyRemoveMergedTaskWithURLIdentifier:URLIdentifier]; + if (error) { + for (AFImageDownloaderResponseHandler *handler in mergedTask.responseHandlers) { + if (handler.failureBlock) { + dispatch_async(dispatch_get_main_queue(), ^{ + handler.failureBlock(request, (NSHTTPURLResponse*)response, error); + }); + } + } + } else { + [strongSelf.imageCache addImage:responseObject forRequest:request withAdditionalIdentifier:nil]; + + for (AFImageDownloaderResponseHandler *handler in mergedTask.responseHandlers) { + if (handler.successBlock) { + dispatch_async(dispatch_get_main_queue(), ^{ + handler.successBlock(request, (NSHTTPURLResponse*)response, responseObject); + }); + } + } + + } + } + [strongSelf safelyDecrementActiveTaskCount]; + [strongSelf safelyStartNextTaskIfNecessary]; + }); + }]; + + // 4) Store the response handler for use when the request completes + AFImageDownloaderResponseHandler *handler = [[AFImageDownloaderResponseHandler alloc] initWithUUID:receiptID + success:success + failure:failure]; + AFImageDownloaderMergedTask *mergedTask = [[AFImageDownloaderMergedTask alloc] + initWithURLIdentifier:URLIdentifier + identifier:mergedTaskIdentifier + task:createdTask]; + [mergedTask addResponseHandler:handler]; + self.mergedTasks[URLIdentifier] = mergedTask; + + // 5) Either start the request or enqueue it depending on the current active request count + if ([self isActiveRequestCountBelowMaximumLimit]) { + [self startMergedTask:mergedTask]; + } else { + [self enqueueMergedTask:mergedTask]; + } + + task = mergedTask.task; + }); + if (task) { + return [[AFImageDownloadReceipt alloc] initWithReceiptID:receiptID task:task]; + } else { + return nil; + } +} + +- (void)cancelTaskForImageDownloadReceipt:(AFImageDownloadReceipt *)imageDownloadReceipt { + dispatch_sync(self.synchronizationQueue, ^{ + NSString *URLIdentifier = imageDownloadReceipt.task.originalRequest.URL.absoluteString; + AFImageDownloaderMergedTask *mergedTask = self.mergedTasks[URLIdentifier]; + NSUInteger index = [mergedTask.responseHandlers indexOfObjectPassingTest:^BOOL(AFImageDownloaderResponseHandler * _Nonnull handler, __unused NSUInteger idx, __unused BOOL * _Nonnull stop) { + return handler.uuid == imageDownloadReceipt.receiptID; + }]; + + if (index != NSNotFound) { + AFImageDownloaderResponseHandler *handler = mergedTask.responseHandlers[index]; + [mergedTask removeResponseHandler:handler]; + NSString *failureReason = [NSString stringWithFormat:@"ImageDownloader cancelled URL request: %@",imageDownloadReceipt.task.originalRequest.URL.absoluteString]; + NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey:failureReason}; + NSError *error = [NSError errorWithDomain:NSURLErrorDomain code:NSURLErrorCancelled userInfo:userInfo]; + if (handler.failureBlock) { + dispatch_async(dispatch_get_main_queue(), ^{ + handler.failureBlock(imageDownloadReceipt.task.originalRequest, nil, error); + }); + } + } + + if (mergedTask.responseHandlers.count == 0 && mergedTask.task.state == NSURLSessionTaskStateSuspended) { + [mergedTask.task cancel]; + [self removeMergedTaskWithURLIdentifier:URLIdentifier]; + } + }); +} + +- (AFImageDownloaderMergedTask*)safelyRemoveMergedTaskWithURLIdentifier:(NSString *)URLIdentifier { + __block AFImageDownloaderMergedTask *mergedTask = nil; + dispatch_sync(self.synchronizationQueue, ^{ + mergedTask = [self removeMergedTaskWithURLIdentifier:URLIdentifier]; + }); + return mergedTask; +} + +//This method should only be called from safely within the synchronizationQueue +- (AFImageDownloaderMergedTask *)removeMergedTaskWithURLIdentifier:(NSString *)URLIdentifier { + AFImageDownloaderMergedTask *mergedTask = self.mergedTasks[URLIdentifier]; + [self.mergedTasks removeObjectForKey:URLIdentifier]; + return mergedTask; +} + +- (void)safelyDecrementActiveTaskCount { + dispatch_sync(self.synchronizationQueue, ^{ + if (self.activeRequestCount > 0) { + self.activeRequestCount -= 1; + } + }); +} + +- (void)safelyStartNextTaskIfNecessary { + dispatch_sync(self.synchronizationQueue, ^{ + if ([self isActiveRequestCountBelowMaximumLimit]) { + while (self.queuedMergedTasks.count > 0) { + AFImageDownloaderMergedTask *mergedTask = [self dequeueMergedTask]; + if (mergedTask.task.state == NSURLSessionTaskStateSuspended) { + [self startMergedTask:mergedTask]; + break; + } + } + } + }); +} + +- (void)startMergedTask:(AFImageDownloaderMergedTask *)mergedTask { + [mergedTask.task resume]; + ++self.activeRequestCount; +} + +- (void)enqueueMergedTask:(AFImageDownloaderMergedTask *)mergedTask { + switch (self.downloadPrioritizaton) { + case AFImageDownloadPrioritizationFIFO: + [self.queuedMergedTasks addObject:mergedTask]; + break; + case AFImageDownloadPrioritizationLIFO: + [self.queuedMergedTasks insertObject:mergedTask atIndex:0]; + break; + } +} + +- (AFImageDownloaderMergedTask *)dequeueMergedTask { + AFImageDownloaderMergedTask *mergedTask = nil; + mergedTask = [self.queuedMergedTasks firstObject]; + [self.queuedMergedTasks removeObject:mergedTask]; + return mergedTask; +} + +- (BOOL)isActiveRequestCountBelowMaximumLimit { + return self.activeRequestCount < self.maximumActiveDownloads; +} + +@end + +#endif diff --git a/its/plugin/projects/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h new file mode 100644 index 00000000..8b05ad3b --- /dev/null +++ b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.h @@ -0,0 +1,103 @@ +// AFNetworkActivityIndicatorManager.h +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import + +#import + +#if TARGET_OS_IOS + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + `AFNetworkActivityIndicatorManager` manages the state of the network activity indicator in the status bar. When enabled, it will listen for notifications indicating that a session task has started or finished, and start or stop animating the indicator accordingly. The number of active requests is incremented and decremented much like a stack or a semaphore, and the activity indicator will animate so long as that number is greater than zero. + + You should enable the shared instance of `AFNetworkActivityIndicatorManager` when your application finishes launching. In `AppDelegate application:didFinishLaunchingWithOptions:` you can do so with the following code: + + [[AFNetworkActivityIndicatorManager sharedManager] setEnabled:YES]; + + By setting `enabled` to `YES` for `sharedManager`, the network activity indicator will show and hide automatically as requests start and finish. You should not ever need to call `incrementActivityCount` or `decrementActivityCount` yourself. + + See the Apple Human Interface Guidelines section about the Network Activity Indicator for more information: + http://developer.apple.com/library/iOS/#documentation/UserExperience/Conceptual/MobileHIG/UIElementGuidelines/UIElementGuidelines.html#//apple_ref/doc/uid/TP40006556-CH13-SW44 + */ +NS_EXTENSION_UNAVAILABLE_IOS("Use view controller based solutions where appropriate instead.") +@interface AFNetworkActivityIndicatorManager : NSObject + +/** + A Boolean value indicating whether the manager is enabled. + + If YES, the manager will change status bar network activity indicator according to network operation notifications it receives. The default value is NO. + */ +@property (nonatomic, assign, getter = isEnabled) BOOL enabled; + +/** + A Boolean value indicating whether the network activity indicator manager is currently active. +*/ +@property (readonly, nonatomic, assign, getter=isNetworkActivityIndicatorVisible) BOOL networkActivityIndicatorVisible; + +/** + A time interval indicating the minimum duration of networking activity that should occur before the activity indicator is displayed. The default value 1 second. If the network activity indicator should be displayed immediately when network activity occurs, this value should be set to 0 seconds. + + Apple's HIG describes the following: + + > Display the network activity indicator to provide feedback when your app accesses the network for more than a couple of seconds. If the operation finishes sooner than that, you don’t have to show the network activity indicator, because the indicator is likely to disappear before users notice its presence. + + */ +@property (nonatomic, assign) NSTimeInterval activationDelay; + +/** + A time interval indicating the duration of time of no networking activity required before the activity indicator is disabled. This allows for continuous display of the network activity indicator across multiple requests. The default value is 0.17 seconds. + */ + +@property (nonatomic, assign) NSTimeInterval completionDelay; + +/** + Returns the shared network activity indicator manager object for the system. + + @return The systemwide network activity indicator manager. + */ ++ (instancetype)sharedManager; + +/** + Increments the number of active network requests. If this number was zero before incrementing, this will start animating the status bar network activity indicator. + */ +- (void)incrementActivityCount; + +/** + Decrements the number of active network requests. If this number becomes zero after decrementing, this will stop animating the status bar network activity indicator. + */ +- (void)decrementActivityCount; + +/** + Set the a custom method to be executed when the network activity indicator manager should be hidden/shown. By default, this is null, and the UIApplication Network Activity Indicator will be managed automatically. If this block is set, it is the responsiblity of the caller to manager the network activity indicator going forward. + + @param block A block to be executed when the network activity indicator status changes. + */ +- (void)setNetworkingActivityActionWithBlock:(nullable void (^)(BOOL networkActivityIndicatorVisible))block; + +@end + +NS_ASSUME_NONNULL_END + +#endif diff --git a/its/plugin/projects/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.m b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.m new file mode 100644 index 00000000..440cf7db --- /dev/null +++ b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/AFNetworkActivityIndicatorManager.m @@ -0,0 +1,261 @@ +// AFNetworkActivityIndicatorManager.m +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "AFNetworkActivityIndicatorManager.h" + +#if TARGET_OS_IOS +#import "AFURLSessionManager.h" + +typedef NS_ENUM(NSInteger, AFNetworkActivityManagerState) { + AFNetworkActivityManagerStateNotActive, + AFNetworkActivityManagerStateDelayingStart, + AFNetworkActivityManagerStateActive, + AFNetworkActivityManagerStateDelayingEnd +}; + +static NSTimeInterval const kDefaultAFNetworkActivityManagerActivationDelay = 1.0; +static NSTimeInterval const kDefaultAFNetworkActivityManagerCompletionDelay = 0.17; + +static NSURLRequest * AFNetworkRequestFromNotification(NSNotification *notification) { + if ([[notification object] respondsToSelector:@selector(originalRequest)]) { + return [(NSURLSessionTask *)[notification object] originalRequest]; + } else { + return nil; + } +} + +typedef void (^AFNetworkActivityActionBlock)(BOOL networkActivityIndicatorVisible); + +@interface AFNetworkActivityIndicatorManager () +@property (readwrite, nonatomic, assign) NSInteger activityCount; +@property (readwrite, nonatomic, strong) NSTimer *activationDelayTimer; +@property (readwrite, nonatomic, strong) NSTimer *completionDelayTimer; +@property (readonly, nonatomic, getter = isNetworkActivityOccurring) BOOL networkActivityOccurring; +@property (nonatomic, copy) AFNetworkActivityActionBlock networkActivityActionBlock; +@property (nonatomic, assign) AFNetworkActivityManagerState currentState; +@property (nonatomic, assign, getter=isNetworkActivityIndicatorVisible) BOOL networkActivityIndicatorVisible; + +- (void)updateCurrentStateForNetworkActivityChange; +@end + +@implementation AFNetworkActivityIndicatorManager + ++ (instancetype)sharedManager { + static AFNetworkActivityIndicatorManager *_sharedManager = nil; + static dispatch_once_t oncePredicate; + dispatch_once(&oncePredicate, ^{ + _sharedManager = [[self alloc] init]; + }); + + return _sharedManager; +} + +- (instancetype)init { + self = [super init]; + if (!self) { + return nil; + } + self.currentState = AFNetworkActivityManagerStateNotActive; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidStart:) name:AFNetworkingTaskDidResumeNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidFinish:) name:AFNetworkingTaskDidSuspendNotification object:nil]; + [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(networkRequestDidFinish:) name:AFNetworkingTaskDidCompleteNotification object:nil]; + self.activationDelay = kDefaultAFNetworkActivityManagerActivationDelay; + self.completionDelay = kDefaultAFNetworkActivityManagerCompletionDelay; + + return self; +} + +- (void)dealloc { + [[NSNotificationCenter defaultCenter] removeObserver:self]; + + [_activationDelayTimer invalidate]; + [_completionDelayTimer invalidate]; +} + +- (void)setEnabled:(BOOL)enabled { + _enabled = enabled; + if (enabled == NO) { + [self setCurrentState:AFNetworkActivityManagerStateNotActive]; + } +} + +- (void)setNetworkingActivityActionWithBlock:(void (^)(BOOL networkActivityIndicatorVisible))block { + self.networkActivityActionBlock = block; +} + +- (BOOL)isNetworkActivityOccurring { + @synchronized(self) { + return self.activityCount > 0; + } +} + +- (void)setNetworkActivityIndicatorVisible:(BOOL)networkActivityIndicatorVisible { + if (_networkActivityIndicatorVisible != networkActivityIndicatorVisible) { + [self willChangeValueForKey:@"networkActivityIndicatorVisible"]; + @synchronized(self) { + _networkActivityIndicatorVisible = networkActivityIndicatorVisible; + } + [self didChangeValueForKey:@"networkActivityIndicatorVisible"]; + if (self.networkActivityActionBlock) { + self.networkActivityActionBlock(networkActivityIndicatorVisible); + } else { + [[UIApplication sharedApplication] setNetworkActivityIndicatorVisible:networkActivityIndicatorVisible]; + } + } +} + +- (void)setActivityCount:(NSInteger)activityCount { + @synchronized(self) { + _activityCount = activityCount; + } + + dispatch_async(dispatch_get_main_queue(), ^{ + [self updateCurrentStateForNetworkActivityChange]; + }); +} + +- (void)incrementActivityCount { + [self willChangeValueForKey:@"activityCount"]; + @synchronized(self) { + _activityCount++; + } + [self didChangeValueForKey:@"activityCount"]; + + dispatch_async(dispatch_get_main_queue(), ^{ + [self updateCurrentStateForNetworkActivityChange]; + }); +} + +- (void)decrementActivityCount { + [self willChangeValueForKey:@"activityCount"]; + @synchronized(self) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu" + _activityCount = MAX(_activityCount - 1, 0); +#pragma clang diagnostic pop + } + [self didChangeValueForKey:@"activityCount"]; + + dispatch_async(dispatch_get_main_queue(), ^{ + [self updateCurrentStateForNetworkActivityChange]; + }); +} + +- (void)networkRequestDidStart:(NSNotification *)notification { + if ([AFNetworkRequestFromNotification(notification) URL]) { + [self incrementActivityCount]; + } +} + +- (void)networkRequestDidFinish:(NSNotification *)notification { + if ([AFNetworkRequestFromNotification(notification) URL]) { + [self decrementActivityCount]; + } +} + +#pragma mark - Internal State Management +- (void)setCurrentState:(AFNetworkActivityManagerState)currentState { + @synchronized(self) { + if (_currentState != currentState) { + [self willChangeValueForKey:@"currentState"]; + _currentState = currentState; + switch (currentState) { + case AFNetworkActivityManagerStateNotActive: + [self cancelActivationDelayTimer]; + [self cancelCompletionDelayTimer]; + [self setNetworkActivityIndicatorVisible:NO]; + break; + case AFNetworkActivityManagerStateDelayingStart: + [self startActivationDelayTimer]; + break; + case AFNetworkActivityManagerStateActive: + [self cancelCompletionDelayTimer]; + [self setNetworkActivityIndicatorVisible:YES]; + break; + case AFNetworkActivityManagerStateDelayingEnd: + [self startCompletionDelayTimer]; + break; + } + } + [self didChangeValueForKey:@"currentState"]; + } +} + +- (void)updateCurrentStateForNetworkActivityChange { + if (self.enabled) { + switch (self.currentState) { + case AFNetworkActivityManagerStateNotActive: + if (self.isNetworkActivityOccurring) { + [self setCurrentState:AFNetworkActivityManagerStateDelayingStart]; + } + break; + case AFNetworkActivityManagerStateDelayingStart: + //No op. Let the delay timer finish out. + break; + case AFNetworkActivityManagerStateActive: + if (!self.isNetworkActivityOccurring) { + [self setCurrentState:AFNetworkActivityManagerStateDelayingEnd]; + } + break; + case AFNetworkActivityManagerStateDelayingEnd: + if (self.isNetworkActivityOccurring) { + [self setCurrentState:AFNetworkActivityManagerStateActive]; + } + break; + } + } +} + +- (void)startActivationDelayTimer { + self.activationDelayTimer = [NSTimer + timerWithTimeInterval:self.activationDelay target:self selector:@selector(activationDelayTimerFired) userInfo:nil repeats:NO]; + [[NSRunLoop mainRunLoop] addTimer:self.activationDelayTimer forMode:NSRunLoopCommonModes]; +} + +- (void)activationDelayTimerFired { + if (self.networkActivityOccurring) { + [self setCurrentState:AFNetworkActivityManagerStateActive]; + } else { + [self setCurrentState:AFNetworkActivityManagerStateNotActive]; + } +} + +- (void)startCompletionDelayTimer { + [self.completionDelayTimer invalidate]; + self.completionDelayTimer = [NSTimer timerWithTimeInterval:self.completionDelay target:self selector:@selector(completionDelayTimerFired) userInfo:nil repeats:NO]; + [[NSRunLoop mainRunLoop] addTimer:self.completionDelayTimer forMode:NSRunLoopCommonModes]; +} + +- (void)completionDelayTimerFired { + [self setCurrentState:AFNetworkActivityManagerStateNotActive]; +} + +- (void)cancelActivationDelayTimer { + [self.activationDelayTimer invalidate]; +} + +- (void)cancelCompletionDelayTimer { + [self.completionDelayTimer invalidate]; +} + +@end + +#endif diff --git a/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h new file mode 100644 index 00000000..82973475 --- /dev/null +++ b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.h @@ -0,0 +1,48 @@ +// UIActivityIndicatorView+AFNetworking.h +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import + +#import + +#if TARGET_OS_IOS || TARGET_OS_TV + +#import + +/** + This category adds methods to the UIKit framework's `UIActivityIndicatorView` class. The methods in this category provide support for automatically starting and stopping animation depending on the loading state of a session task. + */ +@interface UIActivityIndicatorView (AFNetworking) + +///---------------------------------- +/// @name Animating for Session Tasks +///---------------------------------- + +/** + Binds the animating state to the state of the specified task. + + @param task The task. If `nil`, automatic updating from any previously specified operation will be disabled. + */ +- (void)setAnimatingWithStateOfTask:(nullable NSURLSessionTask *)task; + +@end + +#endif diff --git a/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.m b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.m new file mode 100644 index 00000000..24c8c76d --- /dev/null +++ b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIActivityIndicatorView+AFNetworking.m @@ -0,0 +1,124 @@ +// UIActivityIndicatorView+AFNetworking.m +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "UIActivityIndicatorView+AFNetworking.h" +#import + +#if TARGET_OS_IOS || TARGET_OS_TV + +#import "AFURLSessionManager.h" + +@interface AFActivityIndicatorViewNotificationObserver : NSObject +@property (readonly, nonatomic, weak) UIActivityIndicatorView *activityIndicatorView; +- (instancetype)initWithActivityIndicatorView:(UIActivityIndicatorView *)activityIndicatorView; + +- (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task; + +@end + +@implementation UIActivityIndicatorView (AFNetworking) + +- (AFActivityIndicatorViewNotificationObserver *)af_notificationObserver { + AFActivityIndicatorViewNotificationObserver *notificationObserver = objc_getAssociatedObject(self, @selector(af_notificationObserver)); + if (notificationObserver == nil) { + notificationObserver = [[AFActivityIndicatorViewNotificationObserver alloc] initWithActivityIndicatorView:self]; + objc_setAssociatedObject(self, @selector(af_notificationObserver), notificationObserver, OBJC_ASSOCIATION_RETAIN_NONATOMIC); + } + return notificationObserver; +} + +- (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task { + [[self af_notificationObserver] setAnimatingWithStateOfTask:task]; +} + +@end + +@implementation AFActivityIndicatorViewNotificationObserver + +- (instancetype)initWithActivityIndicatorView:(UIActivityIndicatorView *)activityIndicatorView +{ + self = [super init]; + if (self) { + _activityIndicatorView = activityIndicatorView; + } + return self; +} + +- (void)setAnimatingWithStateOfTask:(NSURLSessionTask *)task { + NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; + + [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil]; + [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil]; + [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil]; + + if (task) { + if (task.state != NSURLSessionTaskStateCompleted) { + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreceiver-is-weak" +#pragma clang diagnostic ignored "-Warc-repeated-use-of-weak" + if (task.state == NSURLSessionTaskStateRunning) { + [self.activityIndicatorView startAnimating]; + } else { + [self.activityIndicatorView stopAnimating]; + } +#pragma clang diagnostic pop + + [notificationCenter addObserver:self selector:@selector(af_startAnimating) name:AFNetworkingTaskDidResumeNotification object:task]; + [notificationCenter addObserver:self selector:@selector(af_stopAnimating) name:AFNetworkingTaskDidCompleteNotification object:task]; + [notificationCenter addObserver:self selector:@selector(af_stopAnimating) name:AFNetworkingTaskDidSuspendNotification object:task]; + } + } +} + +#pragma mark - + +- (void)af_startAnimating { + dispatch_async(dispatch_get_main_queue(), ^{ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreceiver-is-weak" + [self.activityIndicatorView startAnimating]; +#pragma clang diagnostic pop + }); +} + +- (void)af_stopAnimating { + dispatch_async(dispatch_get_main_queue(), ^{ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreceiver-is-weak" + [self.activityIndicatorView stopAnimating]; +#pragma clang diagnostic pop + }); +} + +#pragma mark - + +- (void)dealloc { + NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; + + [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil]; + [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil]; + [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil]; +} + +@end + +#endif diff --git a/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.h b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.h new file mode 100644 index 00000000..2f4cdab7 --- /dev/null +++ b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.h @@ -0,0 +1,175 @@ +// UIButton+AFNetworking.h +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import + +#import + +#if TARGET_OS_IOS || TARGET_OS_TV + +#import + +NS_ASSUME_NONNULL_BEGIN + +@class AFImageDownloader; + +/** + This category adds methods to the UIKit framework's `UIButton` class. The methods in this category provide support for loading remote images and background images asynchronously from a URL. + + @warning Compound values for control `state` (such as `UIControlStateHighlighted | UIControlStateDisabled`) are unsupported. + */ +@interface UIButton (AFNetworking) + +///------------------------------------ +/// @name Accessing the Image Downloader +///------------------------------------ + +/** + Set the shared image downloader used to download images. + + @param imageDownloader The shared image downloader used to download images. +*/ ++ (void)setSharedImageDownloader:(AFImageDownloader *)imageDownloader; + +/** + The shared image downloader used to download images. + */ ++ (AFImageDownloader *)sharedImageDownloader; + +///-------------------- +/// @name Setting Image +///-------------------- + +/** + Asynchronously downloads an image from the specified URL, and sets it as the image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled. + + If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. + + @param state The control state. + @param url The URL used for the image request. + */ +- (void)setImageForState:(UIControlState)state + withURL:(NSURL *)url; + +/** + Asynchronously downloads an image from the specified URL, and sets it as the image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled. + + If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. + + @param state The control state. + @param url The URL used for the image request. + @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the button will not change its image until the image request finishes. + */ +- (void)setImageForState:(UIControlState)state + withURL:(NSURL *)url + placeholderImage:(nullable UIImage *)placeholderImage; + +/** + Asynchronously downloads an image from the specified URL request, and sets it as the image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled. + + If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. + + If a success block is specified, it is the responsibility of the block to set the image of the button before returning. If no success block is specified, the default behavior of setting the image with `setImage:forState:` is applied. + + @param state The control state. + @param urlRequest The URL request used for the image request. + @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the button will not change its image until the image request finishes. + @param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`. + @param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred. + */ +- (void)setImageForState:(UIControlState)state + withURLRequest:(NSURLRequest *)urlRequest + placeholderImage:(nullable UIImage *)placeholderImage + success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success + failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure; + + +///------------------------------- +/// @name Setting Background Image +///------------------------------- + +/** + Asynchronously downloads an image from the specified URL, and sets it as the background image for the specified state once the request is finished. Any previous background image request for the receiver will be cancelled. + + If the background image is cached locally, the background image is set immediately, otherwise the specified placeholder background image will be set immediately, and then the remote background image will be set once the request is finished. + + @param state The control state. + @param url The URL used for the background image request. + */ +- (void)setBackgroundImageForState:(UIControlState)state + withURL:(NSURL *)url; + +/** + Asynchronously downloads an image from the specified URL, and sets it as the background image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled. + + If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. + + @param state The control state. + @param url The URL used for the background image request. + @param placeholderImage The background image to be set initially, until the background image request finishes. If `nil`, the button will not change its background image until the background image request finishes. + */ +- (void)setBackgroundImageForState:(UIControlState)state + withURL:(NSURL *)url + placeholderImage:(nullable UIImage *)placeholderImage; + +/** + Asynchronously downloads an image from the specified URL request, and sets it as the image for the specified state once the request is finished. Any previous image request for the receiver will be cancelled. + + If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. + + If a success block is specified, it is the responsibility of the block to set the image of the button before returning. If no success block is specified, the default behavior of setting the image with `setBackgroundImage:forState:` is applied. + + @param state The control state. + @param urlRequest The URL request used for the image request. + @param placeholderImage The background image to be set initially, until the background image request finishes. If `nil`, the button will not change its background image until the background image request finishes. + @param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`. + @param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred. + */ +- (void)setBackgroundImageForState:(UIControlState)state + withURLRequest:(NSURLRequest *)urlRequest + placeholderImage:(nullable UIImage *)placeholderImage + success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success + failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure; + + +///------------------------------ +/// @name Canceling Image Loading +///------------------------------ + +/** + Cancels any executing image task for the specified control state of the receiver, if one exists. + + @param state The control state. + */ +- (void)cancelImageDownloadTaskForState:(UIControlState)state; + +/** + Cancels any executing background image task for the specified control state of the receiver, if one exists. + + @param state The control state. + */ +- (void)cancelBackgroundImageDownloadTaskForState:(UIControlState)state; + +@end + +NS_ASSUME_NONNULL_END + +#endif diff --git a/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.m b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.m new file mode 100644 index 00000000..9ea2b995 --- /dev/null +++ b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIButton+AFNetworking.m @@ -0,0 +1,305 @@ +// UIButton+AFNetworking.m +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "UIButton+AFNetworking.h" + +#import + +#if TARGET_OS_IOS || TARGET_OS_TV + +#import "UIImageView+AFNetworking.h" +#import "AFImageDownloader.h" + +@interface UIButton (_AFNetworking) +@end + +@implementation UIButton (_AFNetworking) + +#pragma mark - + +static char AFImageDownloadReceiptNormal; +static char AFImageDownloadReceiptHighlighted; +static char AFImageDownloadReceiptSelected; +static char AFImageDownloadReceiptDisabled; + +static const char * af_imageDownloadReceiptKeyForState(UIControlState state) { + switch (state) { + case UIControlStateHighlighted: + return &AFImageDownloadReceiptHighlighted; + case UIControlStateSelected: + return &AFImageDownloadReceiptSelected; + case UIControlStateDisabled: + return &AFImageDownloadReceiptDisabled; + case UIControlStateNormal: + default: + return &AFImageDownloadReceiptNormal; + } +} + +- (AFImageDownloadReceipt *)af_imageDownloadReceiptForState:(UIControlState)state { + return (AFImageDownloadReceipt *)objc_getAssociatedObject(self, af_imageDownloadReceiptKeyForState(state)); +} + +- (void)af_setImageDownloadReceipt:(AFImageDownloadReceipt *)imageDownloadReceipt + forState:(UIControlState)state +{ + objc_setAssociatedObject(self, af_imageDownloadReceiptKeyForState(state), imageDownloadReceipt, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +#pragma mark - + +static char AFBackgroundImageDownloadReceiptNormal; +static char AFBackgroundImageDownloadReceiptHighlighted; +static char AFBackgroundImageDownloadReceiptSelected; +static char AFBackgroundImageDownloadReceiptDisabled; + +static const char * af_backgroundImageDownloadReceiptKeyForState(UIControlState state) { + switch (state) { + case UIControlStateHighlighted: + return &AFBackgroundImageDownloadReceiptHighlighted; + case UIControlStateSelected: + return &AFBackgroundImageDownloadReceiptSelected; + case UIControlStateDisabled: + return &AFBackgroundImageDownloadReceiptDisabled; + case UIControlStateNormal: + default: + return &AFBackgroundImageDownloadReceiptNormal; + } +} + +- (AFImageDownloadReceipt *)af_backgroundImageDownloadReceiptForState:(UIControlState)state { + return (AFImageDownloadReceipt *)objc_getAssociatedObject(self, af_backgroundImageDownloadReceiptKeyForState(state)); +} + +- (void)af_setBackgroundImageDownloadReceipt:(AFImageDownloadReceipt *)imageDownloadReceipt + forState:(UIControlState)state +{ + objc_setAssociatedObject(self, af_backgroundImageDownloadReceiptKeyForState(state), imageDownloadReceipt, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +@end + +#pragma mark - + +@implementation UIButton (AFNetworking) + ++ (AFImageDownloader *)sharedImageDownloader { + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu" + return objc_getAssociatedObject(self, @selector(sharedImageDownloader)) ?: [AFImageDownloader defaultInstance]; +#pragma clang diagnostic pop +} + ++ (void)setSharedImageDownloader:(AFImageDownloader *)imageDownloader { + objc_setAssociatedObject(self, @selector(sharedImageDownloader), imageDownloader, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +#pragma mark - + +- (void)setImageForState:(UIControlState)state + withURL:(NSURL *)url +{ + [self setImageForState:state withURL:url placeholderImage:nil]; +} + +- (void)setImageForState:(UIControlState)state + withURL:(NSURL *)url + placeholderImage:(UIImage *)placeholderImage +{ + NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; + [request addValue:@"image/*" forHTTPHeaderField:@"Accept"]; + + [self setImageForState:state withURLRequest:request placeholderImage:placeholderImage success:nil failure:nil]; +} + +- (void)setImageForState:(UIControlState)state + withURLRequest:(NSURLRequest *)urlRequest + placeholderImage:(nullable UIImage *)placeholderImage + success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success + failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure +{ + if ([self isActiveTaskURLEqualToURLRequest:urlRequest forState:state]) { + return; + } + + [self cancelImageDownloadTaskForState:state]; + + AFImageDownloader *downloader = [[self class] sharedImageDownloader]; + id imageCache = downloader.imageCache; + + //Use the image from the image cache if it exists + UIImage *cachedImage = [imageCache imageforRequest:urlRequest withAdditionalIdentifier:nil]; + if (cachedImage) { + if (success) { + success(urlRequest, nil, cachedImage); + } else { + [self setImage:cachedImage forState:state]; + } + [self af_setImageDownloadReceipt:nil forState:state]; + } else { + if (placeholderImage) { + [self setImage:placeholderImage forState:state]; + } + + __weak __typeof(self)weakSelf = self; + NSUUID *downloadID = [NSUUID UUID]; + AFImageDownloadReceipt *receipt; + receipt = [downloader + downloadImageForURLRequest:urlRequest + withReceiptID:downloadID + success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) { + __strong __typeof(weakSelf)strongSelf = weakSelf; + if ([[strongSelf af_imageDownloadReceiptForState:state].receiptID isEqual:downloadID]) { + if (success) { + success(request, response, responseObject); + } else if(responseObject) { + [strongSelf setImage:responseObject forState:state]; + } + [strongSelf af_setImageDownloadReceipt:nil forState:state]; + } + + } + failure:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, NSError * _Nonnull error) { + __strong __typeof(weakSelf)strongSelf = weakSelf; + if ([[strongSelf af_imageDownloadReceiptForState:state].receiptID isEqual:downloadID]) { + if (failure) { + failure(request, response, error); + } + [strongSelf af_setImageDownloadReceipt:nil forState:state]; + } + }]; + + [self af_setImageDownloadReceipt:receipt forState:state]; + } +} + +#pragma mark - + +- (void)setBackgroundImageForState:(UIControlState)state + withURL:(NSURL *)url +{ + [self setBackgroundImageForState:state withURL:url placeholderImage:nil]; +} + +- (void)setBackgroundImageForState:(UIControlState)state + withURL:(NSURL *)url + placeholderImage:(nullable UIImage *)placeholderImage +{ + NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; + [request addValue:@"image/*" forHTTPHeaderField:@"Accept"]; + + [self setBackgroundImageForState:state withURLRequest:request placeholderImage:placeholderImage success:nil failure:nil]; +} + +- (void)setBackgroundImageForState:(UIControlState)state + withURLRequest:(NSURLRequest *)urlRequest + placeholderImage:(nullable UIImage *)placeholderImage + success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success + failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure +{ + if ([self isActiveBackgroundTaskURLEqualToURLRequest:urlRequest forState:state]) { + return; + } + + [self cancelImageDownloadTaskForState:state]; + + AFImageDownloader *downloader = [[self class] sharedImageDownloader]; + id imageCache = downloader.imageCache; + + //Use the image from the image cache if it exists + UIImage *cachedImage = [imageCache imageforRequest:urlRequest withAdditionalIdentifier:nil]; + if (cachedImage) { + if (success) { + success(urlRequest, nil, cachedImage); + } else { + [self setBackgroundImage:cachedImage forState:state]; + } + [self af_setBackgroundImageDownloadReceipt:nil forState:state]; + } else { + if (placeholderImage) { + [self setBackgroundImage:placeholderImage forState:state]; + } + + __weak __typeof(self)weakSelf = self; + NSUUID *downloadID = [NSUUID UUID]; + AFImageDownloadReceipt *receipt; + receipt = [downloader + downloadImageForURLRequest:urlRequest + withReceiptID:downloadID + success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) { + __strong __typeof(weakSelf)strongSelf = weakSelf; + if ([[strongSelf af_backgroundImageDownloadReceiptForState:state].receiptID isEqual:downloadID]) { + if (success) { + success(request, response, responseObject); + } else if(responseObject) { + [strongSelf setBackgroundImage:responseObject forState:state]; + } + [strongSelf af_setImageDownloadReceipt:nil forState:state]; + } + + } + failure:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, NSError * _Nonnull error) { + __strong __typeof(weakSelf)strongSelf = weakSelf; + if ([[strongSelf af_backgroundImageDownloadReceiptForState:state].receiptID isEqual:downloadID]) { + if (failure) { + failure(request, response, error); + } + [strongSelf af_setBackgroundImageDownloadReceipt:nil forState:state]; + } + }]; + + [self af_setBackgroundImageDownloadReceipt:receipt forState:state]; + } +} + +#pragma mark - + +- (void)cancelImageDownloadTaskForState:(UIControlState)state { + AFImageDownloadReceipt *receipt = [self af_imageDownloadReceiptForState:state]; + if (receipt != nil) { + [[self.class sharedImageDownloader] cancelTaskForImageDownloadReceipt:receipt]; + [self af_setImageDownloadReceipt:nil forState:state]; + } +} + +- (void)cancelBackgroundImageDownloadTaskForState:(UIControlState)state { + AFImageDownloadReceipt *receipt = [self af_backgroundImageDownloadReceiptForState:state]; + if (receipt != nil) { + [[self.class sharedImageDownloader] cancelTaskForImageDownloadReceipt:receipt]; + [self af_setBackgroundImageDownloadReceipt:nil forState:state]; + } +} + +- (BOOL)isActiveTaskURLEqualToURLRequest:(NSURLRequest *)urlRequest forState:(UIControlState)state { + AFImageDownloadReceipt *receipt = [self af_imageDownloadReceiptForState:state]; + return [receipt.task.originalRequest.URL.absoluteString isEqualToString:urlRequest.URL.absoluteString]; +} + +- (BOOL)isActiveBackgroundTaskURLEqualToURLRequest:(NSURLRequest *)urlRequest forState:(UIControlState)state { + AFImageDownloadReceipt *receipt = [self af_backgroundImageDownloadReceiptForState:state]; + return [receipt.task.originalRequest.URL.absoluteString isEqualToString:urlRequest.URL.absoluteString]; +} + + +@end + +#endif diff --git a/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIImage+AFNetworking.h b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIImage+AFNetworking.h new file mode 100644 index 00000000..14744cdd --- /dev/null +++ b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIImage+AFNetworking.h @@ -0,0 +1,35 @@ +// +// UIImage+AFNetworking.h +// +// +// Created by Paulo Ferreira on 08/07/15. +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#if TARGET_OS_IOS || TARGET_OS_TV + +#import + +@interface UIImage (AFNetworking) + ++ (UIImage*) safeImageWithData:(NSData*)data; + +@end + +#endif diff --git a/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h new file mode 100644 index 00000000..06df54ac --- /dev/null +++ b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.h @@ -0,0 +1,109 @@ +// UIImageView+AFNetworking.h +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import + +#import + +#if TARGET_OS_IOS || TARGET_OS_TV + +#import + +NS_ASSUME_NONNULL_BEGIN + +@class AFImageDownloader; + +/** + This category adds methods to the UIKit framework's `UIImageView` class. The methods in this category provide support for loading remote images asynchronously from a URL. + */ +@interface UIImageView (AFNetworking) + +///------------------------------------ +/// @name Accessing the Image Downloader +///------------------------------------ + +/** + Set the shared image downloader used to download images. + + @param imageDownloader The shared image downloader used to download images. + */ ++ (void)setSharedImageDownloader:(AFImageDownloader *)imageDownloader; + +/** + The shared image downloader used to download images. + */ ++ (AFImageDownloader *)sharedImageDownloader; + +///-------------------- +/// @name Setting Image +///-------------------- + +/** + Asynchronously downloads an image from the specified URL, and sets it once the request is finished. Any previous image request for the receiver will be cancelled. + + If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. + + By default, URL requests have a `Accept` header field value of "image / *", a cache policy of `NSURLCacheStorageAllowed` and a timeout interval of 30 seconds, and are set not handle cookies. To configure URL requests differently, use `setImageWithURLRequest:placeholderImage:success:failure:` + + @param url The URL used for the image request. + */ +- (void)setImageWithURL:(NSURL *)url; + +/** + Asynchronously downloads an image from the specified URL, and sets it once the request is finished. Any previous image request for the receiver will be cancelled. + + If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. + + By default, URL requests have a `Accept` header field value of "image / *", a cache policy of `NSURLCacheStorageAllowed` and a timeout interval of 30 seconds, and are set not handle cookies. To configure URL requests differently, use `setImageWithURLRequest:placeholderImage:success:failure:` + + @param url The URL used for the image request. + @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the image view will not change its image until the image request finishes. + */ +- (void)setImageWithURL:(NSURL *)url + placeholderImage:(nullable UIImage *)placeholderImage; + +/** + Asynchronously downloads an image from the specified URL request, and sets it once the request is finished. Any previous image request for the receiver will be cancelled. + + If the image is cached locally, the image is set immediately, otherwise the specified placeholder image will be set immediately, and then the remote image will be set once the request is finished. + + If a success block is specified, it is the responsibility of the block to set the image of the image view before returning. If no success block is specified, the default behavior of setting the image with `self.image = image` is applied. + + @param urlRequest The URL request used for the image request. + @param placeholderImage The image to be set initially, until the image request finishes. If `nil`, the image view will not change its image until the image request finishes. + @param success A block to be executed when the image data task finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the image created from the response data of request. If the image was returned from cache, the response parameter will be `nil`. + @param failure A block object to be executed when the image data task finishes unsuccessfully, or that finishes successfully. This block has no return value and takes three arguments: the request sent from the client, the response received from the server, and the error object describing the network or parsing error that occurred. + */ +- (void)setImageWithURLRequest:(NSURLRequest *)urlRequest + placeholderImage:(nullable UIImage *)placeholderImage + success:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success + failure:(nullable void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure; + +/** + Cancels any executing image operation for the receiver, if one exists. + */ +- (void)cancelImageDownloadTask; + +@end + +NS_ASSUME_NONNULL_END + +#endif diff --git a/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.m b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.m new file mode 100644 index 00000000..b4189305 --- /dev/null +++ b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIImageView+AFNetworking.m @@ -0,0 +1,161 @@ +// UIImageView+AFNetworking.m +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "UIImageView+AFNetworking.h" + +#import + +#if TARGET_OS_IOS || TARGET_OS_TV + +#import "AFImageDownloader.h" + +@interface UIImageView (_AFNetworking) +@property (readwrite, nonatomic, strong, setter = af_setActiveImageDownloadReceipt:) AFImageDownloadReceipt *af_activeImageDownloadReceipt; +@end + +@implementation UIImageView (_AFNetworking) + +- (AFImageDownloadReceipt *)af_activeImageDownloadReceipt { + return (AFImageDownloadReceipt *)objc_getAssociatedObject(self, @selector(af_activeImageDownloadReceipt)); +} + +- (void)af_setActiveImageDownloadReceipt:(AFImageDownloadReceipt *)imageDownloadReceipt { + objc_setAssociatedObject(self, @selector(af_activeImageDownloadReceipt), imageDownloadReceipt, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +@end + +#pragma mark - + +@implementation UIImageView (AFNetworking) + ++ (AFImageDownloader *)sharedImageDownloader { + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu" + return objc_getAssociatedObject(self, @selector(sharedImageDownloader)) ?: [AFImageDownloader defaultInstance]; +#pragma clang diagnostic pop +} + ++ (void)setSharedImageDownloader:(AFImageDownloader *)imageDownloader { + objc_setAssociatedObject(self, @selector(sharedImageDownloader), imageDownloader, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +#pragma mark - + +- (void)setImageWithURL:(NSURL *)url { + [self setImageWithURL:url placeholderImage:nil]; +} + +- (void)setImageWithURL:(NSURL *)url + placeholderImage:(UIImage *)placeholderImage +{ + NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; + [request addValue:@"image/*" forHTTPHeaderField:@"Accept"]; + + [self setImageWithURLRequest:request placeholderImage:placeholderImage success:nil failure:nil]; +} + +- (void)setImageWithURLRequest:(NSURLRequest *)urlRequest + placeholderImage:(UIImage *)placeholderImage + success:(void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, UIImage *image))success + failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse * _Nullable response, NSError *error))failure +{ + + if ([urlRequest URL] == nil) { + [self cancelImageDownloadTask]; + self.image = placeholderImage; + return; + } + + if ([self isActiveTaskURLEqualToURLRequest:urlRequest]){ + return; + } + + [self cancelImageDownloadTask]; + + AFImageDownloader *downloader = [[self class] sharedImageDownloader]; + id imageCache = downloader.imageCache; + + //Use the image from the image cache if it exists + UIImage *cachedImage = [imageCache imageforRequest:urlRequest withAdditionalIdentifier:nil]; + if (cachedImage) { + if (success) { + success(urlRequest, nil, cachedImage); + } else { + self.image = cachedImage; + } + [self clearActiveDownloadInformation]; + } else { + if (placeholderImage) { + self.image = placeholderImage; + } + + __weak __typeof(self)weakSelf = self; + NSUUID *downloadID = [NSUUID UUID]; + AFImageDownloadReceipt *receipt; + receipt = [downloader + downloadImageForURLRequest:urlRequest + withReceiptID:downloadID + success:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, UIImage * _Nonnull responseObject) { + __strong __typeof(weakSelf)strongSelf = weakSelf; + if ([strongSelf.af_activeImageDownloadReceipt.receiptID isEqual:downloadID]) { + if (success) { + success(request, response, responseObject); + } else if(responseObject) { + strongSelf.image = responseObject; + } + [strongSelf clearActiveDownloadInformation]; + } + + } + failure:^(NSURLRequest * _Nonnull request, NSHTTPURLResponse * _Nullable response, NSError * _Nonnull error) { + __strong __typeof(weakSelf)strongSelf = weakSelf; + if ([strongSelf.af_activeImageDownloadReceipt.receiptID isEqual:downloadID]) { + if (failure) { + failure(request, response, error); + } + [strongSelf clearActiveDownloadInformation]; + } + }]; + + self.af_activeImageDownloadReceipt = receipt; + } +} + +- (void)cancelImageDownloadTask { + if (self.af_activeImageDownloadReceipt != nil) { + [[self.class sharedImageDownloader] cancelTaskForImageDownloadReceipt:self.af_activeImageDownloadReceipt]; + [self clearActiveDownloadInformation]; + } +} + +- (void)clearActiveDownloadInformation { + self.af_activeImageDownloadReceipt = nil; +} + +- (BOOL)isActiveTaskURLEqualToURLRequest:(NSURLRequest *)urlRequest { + return [self.af_activeImageDownloadReceipt.task.originalRequest.URL.absoluteString isEqualToString:urlRequest.URL.absoluteString]; +} + +@end + +#endif diff --git a/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h new file mode 100644 index 00000000..8f1590be --- /dev/null +++ b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIKit+AFNetworking.h @@ -0,0 +1,42 @@ +// UIKit+AFNetworking.h +// +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#if TARGET_OS_IOS || TARGET_OS_TV +#import + +#ifndef _UIKIT_AFNETWORKING_ + #define _UIKIT_AFNETWORKING_ + +#if TARGET_OS_IOS + #import "AFAutoPurgingImageCache.h" + #import "AFImageDownloader.h" + #import "AFNetworkActivityIndicatorManager.h" + #import "UIRefreshControl+AFNetworking.h" + #import "UIWebView+AFNetworking.h" +#endif + + #import "UIActivityIndicatorView+AFNetworking.h" + #import "UIButton+AFNetworking.h" + #import "UIImageView+AFNetworking.h" + #import "UIProgressView+AFNetworking.h" +#endif /* _UIKIT_AFNETWORKING_ */ +#endif diff --git a/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h new file mode 100644 index 00000000..c9d7e3e2 --- /dev/null +++ b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.h @@ -0,0 +1,64 @@ +// UIProgressView+AFNetworking.h +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import + +#import + +#if TARGET_OS_IOS || TARGET_OS_TV + +#import + +NS_ASSUME_NONNULL_BEGIN + + +/** + This category adds methods to the UIKit framework's `UIProgressView` class. The methods in this category provide support for binding the progress to the upload and download progress of a session task. + */ +@interface UIProgressView (AFNetworking) + +///------------------------------------ +/// @name Setting Session Task Progress +///------------------------------------ + +/** + Binds the progress to the upload progress of the specified session task. + + @param task The session task. + @param animated `YES` if the change should be animated, `NO` if the change should happen immediately. + */ +- (void)setProgressWithUploadProgressOfTask:(NSURLSessionUploadTask *)task + animated:(BOOL)animated; + +/** + Binds the progress to the download progress of the specified session task. + + @param task The session task. + @param animated `YES` if the change should be animated, `NO` if the change should happen immediately. + */ +- (void)setProgressWithDownloadProgressOfTask:(NSURLSessionDownloadTask *)task + animated:(BOOL)animated; + +@end + +NS_ASSUME_NONNULL_END + +#endif diff --git a/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.m b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.m new file mode 100644 index 00000000..5934a617 --- /dev/null +++ b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIProgressView+AFNetworking.m @@ -0,0 +1,118 @@ +// UIProgressView+AFNetworking.m +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "UIProgressView+AFNetworking.h" + +#import + +#if TARGET_OS_IOS || TARGET_OS_TV + +#import "AFURLSessionManager.h" + +static void * AFTaskCountOfBytesSentContext = &AFTaskCountOfBytesSentContext; +static void * AFTaskCountOfBytesReceivedContext = &AFTaskCountOfBytesReceivedContext; + +#pragma mark - + +@implementation UIProgressView (AFNetworking) + +- (BOOL)af_uploadProgressAnimated { + return [(NSNumber *)objc_getAssociatedObject(self, @selector(af_uploadProgressAnimated)) boolValue]; +} + +- (void)af_setUploadProgressAnimated:(BOOL)animated { + objc_setAssociatedObject(self, @selector(af_uploadProgressAnimated), @(animated), OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (BOOL)af_downloadProgressAnimated { + return [(NSNumber *)objc_getAssociatedObject(self, @selector(af_downloadProgressAnimated)) boolValue]; +} + +- (void)af_setDownloadProgressAnimated:(BOOL)animated { + objc_setAssociatedObject(self, @selector(af_downloadProgressAnimated), @(animated), OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +#pragma mark - + +- (void)setProgressWithUploadProgressOfTask:(NSURLSessionUploadTask *)task + animated:(BOOL)animated +{ + [task addObserver:self forKeyPath:@"state" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesSentContext]; + [task addObserver:self forKeyPath:@"countOfBytesSent" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesSentContext]; + + [self af_setUploadProgressAnimated:animated]; +} + +- (void)setProgressWithDownloadProgressOfTask:(NSURLSessionDownloadTask *)task + animated:(BOOL)animated +{ + [task addObserver:self forKeyPath:@"state" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesReceivedContext]; + [task addObserver:self forKeyPath:@"countOfBytesReceived" options:(NSKeyValueObservingOptions)0 context:AFTaskCountOfBytesReceivedContext]; + + [self af_setDownloadProgressAnimated:animated]; +} + +#pragma mark - NSKeyValueObserving + +- (void)observeValueForKeyPath:(NSString *)keyPath + ofObject:(id)object + change:(__unused NSDictionary *)change + context:(void *)context +{ + if (context == AFTaskCountOfBytesSentContext || context == AFTaskCountOfBytesReceivedContext) { + if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesSent))]) { + if ([object countOfBytesExpectedToSend] > 0) { + dispatch_async(dispatch_get_main_queue(), ^{ + [self setProgress:[object countOfBytesSent] / ([object countOfBytesExpectedToSend] * 1.0f) animated:self.af_uploadProgressAnimated]; + }); + } + } + + if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesReceived))]) { + if ([object countOfBytesExpectedToReceive] > 0) { + dispatch_async(dispatch_get_main_queue(), ^{ + [self setProgress:[object countOfBytesReceived] / ([object countOfBytesExpectedToReceive] * 1.0f) animated:self.af_downloadProgressAnimated]; + }); + } + } + + if ([keyPath isEqualToString:NSStringFromSelector(@selector(state))]) { + if ([(NSURLSessionTask *)object state] == NSURLSessionTaskStateCompleted) { + @try { + [object removeObserver:self forKeyPath:NSStringFromSelector(@selector(state))]; + + if (context == AFTaskCountOfBytesSentContext) { + [object removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesSent))]; + } + + if (context == AFTaskCountOfBytesReceivedContext) { + [object removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesReceived))]; + } + } + @catch (NSException * __unused exception) {} + } + } + } +} + +@end + +#endif diff --git a/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h new file mode 100644 index 00000000..a6e598e8 --- /dev/null +++ b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.h @@ -0,0 +1,53 @@ +// UIRefreshControl+AFNetworking.m +// +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import + +#import + +#if TARGET_OS_IOS + +#import + +NS_ASSUME_NONNULL_BEGIN + +/** + This category adds methods to the UIKit framework's `UIRefreshControl` class. The methods in this category provide support for automatically beginning and ending refreshing depending on the loading state of a session task. + */ +@interface UIRefreshControl (AFNetworking) + +///----------------------------------- +/// @name Refreshing for Session Tasks +///----------------------------------- + +/** + Binds the refreshing state to the state of the specified task. + + @param task The task. If `nil`, automatic updating from any previously specified operation will be disabled. + */ +- (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task; + +@end + +NS_ASSUME_NONNULL_END + +#endif diff --git a/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.m b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.m new file mode 100644 index 00000000..d40d01ff --- /dev/null +++ b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIRefreshControl+AFNetworking.m @@ -0,0 +1,122 @@ +// UIRefreshControl+AFNetworking.m +// +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "UIRefreshControl+AFNetworking.h" +#import + +#if TARGET_OS_IOS + +#import "AFURLSessionManager.h" + +@interface AFRefreshControlNotificationObserver : NSObject +@property (readonly, nonatomic, weak) UIRefreshControl *refreshControl; +- (instancetype)initWithActivityRefreshControl:(UIRefreshControl *)refreshControl; + +- (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task; + +@end + +@implementation UIRefreshControl (AFNetworking) + +- (AFRefreshControlNotificationObserver *)af_notificationObserver { + AFRefreshControlNotificationObserver *notificationObserver = objc_getAssociatedObject(self, @selector(af_notificationObserver)); + if (notificationObserver == nil) { + notificationObserver = [[AFRefreshControlNotificationObserver alloc] initWithActivityRefreshControl:self]; + objc_setAssociatedObject(self, @selector(af_notificationObserver), notificationObserver, OBJC_ASSOCIATION_RETAIN_NONATOMIC); + } + return notificationObserver; +} + +- (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task { + [[self af_notificationObserver] setRefreshingWithStateOfTask:task]; +} + +@end + +@implementation AFRefreshControlNotificationObserver + +- (instancetype)initWithActivityRefreshControl:(UIRefreshControl *)refreshControl +{ + self = [super init]; + if (self) { + _refreshControl = refreshControl; + } + return self; +} + +- (void)setRefreshingWithStateOfTask:(NSURLSessionTask *)task { + NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; + + [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil]; + [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil]; + [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil]; + + if (task) { +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreceiver-is-weak" +#pragma clang diagnostic ignored "-Warc-repeated-use-of-weak" + if (task.state == NSURLSessionTaskStateRunning) { + [self.refreshControl beginRefreshing]; + + [notificationCenter addObserver:self selector:@selector(af_beginRefreshing) name:AFNetworkingTaskDidResumeNotification object:task]; + [notificationCenter addObserver:self selector:@selector(af_endRefreshing) name:AFNetworkingTaskDidCompleteNotification object:task]; + [notificationCenter addObserver:self selector:@selector(af_endRefreshing) name:AFNetworkingTaskDidSuspendNotification object:task]; + } else { + [self.refreshControl endRefreshing]; + } +#pragma clang diagnostic pop + } +} + +#pragma mark - + +- (void)af_beginRefreshing { + dispatch_async(dispatch_get_main_queue(), ^{ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreceiver-is-weak" + [self.refreshControl beginRefreshing]; +#pragma clang diagnostic pop + }); +} + +- (void)af_endRefreshing { + dispatch_async(dispatch_get_main_queue(), ^{ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wreceiver-is-weak" + [self.refreshControl endRefreshing]; +#pragma clang diagnostic pop + }); +} + +#pragma mark - + +- (void)dealloc { + NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; + + [notificationCenter removeObserver:self name:AFNetworkingTaskDidCompleteNotification object:nil]; + [notificationCenter removeObserver:self name:AFNetworkingTaskDidResumeNotification object:nil]; + [notificationCenter removeObserver:self name:AFNetworkingTaskDidSuspendNotification object:nil]; +} + +@end + +#endif diff --git a/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h new file mode 100644 index 00000000..41c3fb21 --- /dev/null +++ b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.h @@ -0,0 +1,80 @@ +// UIWebView+AFNetworking.h +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import + +#import + +#if TARGET_OS_IOS + +#import + +NS_ASSUME_NONNULL_BEGIN + +@class AFHTTPSessionManager; + +/** + This category adds methods to the UIKit framework's `UIWebView` class. The methods in this category provide increased control over the request cycle, including progress monitoring and success / failure handling. + + @discussion When using these category methods, make sure to assign `delegate` for the web view, which implements `–webView:shouldStartLoadWithRequest:navigationType:` appropriately. This allows for tapped links to be loaded through AFNetworking, and can ensure that `canGoBack` & `canGoForward` update their values correctly. + */ +@interface UIWebView (AFNetworking) + +/** + The session manager used to download all requests. + */ +@property (nonatomic, strong) AFHTTPSessionManager *sessionManager; + +/** + Asynchronously loads the specified request. + + @param request A URL request identifying the location of the content to load. This must not be `nil`. + @param progress A progress object monitoring the current download progress. + @param success A block object to be executed when the request finishes loading successfully. This block returns the HTML string to be loaded by the web view, and takes two arguments: the response, and the response string. + @param failure A block object to be executed when the data task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a single argument: the error that occurred. + */ +- (void)loadRequest:(NSURLRequest *)request + progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress + success:(nullable NSString * (^)(NSHTTPURLResponse *response, NSString *HTML))success + failure:(nullable void (^)(NSError *error))failure; + +/** + Asynchronously loads the data associated with a particular request with a specified MIME type and text encoding. + + @param request A URL request identifying the location of the content to load. This must not be `nil`. + @param MIMEType The MIME type of the content. Defaults to the content type of the response if not specified. + @param textEncodingName The IANA encoding name, as in `utf-8` or `utf-16`. Defaults to the response text encoding if not specified. +@param progress A progress object monitoring the current download progress. + @param success A block object to be executed when the request finishes loading successfully. This block returns the data to be loaded by the web view and takes two arguments: the response, and the downloaded data. + @param failure A block object to be executed when the data task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a single argument: the error that occurred. + */ +- (void)loadRequest:(NSURLRequest *)request + MIMEType:(nullable NSString *)MIMEType + textEncodingName:(nullable NSString *)textEncodingName + progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress + success:(nullable NSData * (^)(NSHTTPURLResponse *response, NSData *data))success + failure:(nullable void (^)(NSError *error))failure; + +@end + +NS_ASSUME_NONNULL_END + +#endif diff --git a/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.m b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.m new file mode 100644 index 00000000..5bc2c79d --- /dev/null +++ b/its/plugin/projects/AFNetworking/UIKit+AFNetworking/UIWebView+AFNetworking.m @@ -0,0 +1,162 @@ +// UIWebView+AFNetworking.m +// Copyright (c) 2011–2016 Alamofire Software Foundation (http://alamofire.org/) +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in +// all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +// THE SOFTWARE. + +#import "UIWebView+AFNetworking.h" + +#import + +#if TARGET_OS_IOS + +#import "AFHTTPSessionManager.h" +#import "AFURLResponseSerialization.h" +#import "AFURLRequestSerialization.h" + +@interface UIWebView (_AFNetworking) +@property (readwrite, nonatomic, strong, setter = af_setURLSessionTask:) NSURLSessionDataTask *af_URLSessionTask; +@end + +@implementation UIWebView (_AFNetworking) + +- (NSURLSessionDataTask *)af_URLSessionTask { + return (NSURLSessionDataTask *)objc_getAssociatedObject(self, @selector(af_URLSessionTask)); +} + +- (void)af_setURLSessionTask:(NSURLSessionDataTask *)af_URLSessionTask { + objc_setAssociatedObject(self, @selector(af_URLSessionTask), af_URLSessionTask, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +@end + +#pragma mark - + +@implementation UIWebView (AFNetworking) + +- (AFHTTPSessionManager *)sessionManager { + static AFHTTPSessionManager *_af_defaultHTTPSessionManager = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + _af_defaultHTTPSessionManager = [[AFHTTPSessionManager alloc] initWithSessionConfiguration:[NSURLSessionConfiguration defaultSessionConfiguration]]; + _af_defaultHTTPSessionManager.requestSerializer = [AFHTTPRequestSerializer serializer]; + _af_defaultHTTPSessionManager.responseSerializer = [AFHTTPResponseSerializer serializer]; + }); + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu" + return objc_getAssociatedObject(self, @selector(sessionManager)) ?: _af_defaultHTTPSessionManager; +#pragma clang diagnostic pop +} + +- (void)setSessionManager:(AFHTTPSessionManager *)sessionManager { + objc_setAssociatedObject(self, @selector(sessionManager), sessionManager, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +- (AFHTTPResponseSerializer *)responseSerializer { + static AFHTTPResponseSerializer *_af_defaultResponseSerializer = nil; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + _af_defaultResponseSerializer = [AFHTTPResponseSerializer serializer]; + }); + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wgnu" + return objc_getAssociatedObject(self, @selector(responseSerializer)) ?: _af_defaultResponseSerializer; +#pragma clang diagnostic pop +} + +- (void)setResponseSerializer:(AFHTTPResponseSerializer *)responseSerializer { + objc_setAssociatedObject(self, @selector(responseSerializer), responseSerializer, OBJC_ASSOCIATION_RETAIN_NONATOMIC); +} + +#pragma mark - + +- (void)loadRequest:(NSURLRequest *)request + progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress + success:(NSString * (^)(NSHTTPURLResponse *response, NSString *HTML))success + failure:(void (^)(NSError *error))failure +{ + [self loadRequest:request MIMEType:nil textEncodingName:nil progress:progress success:^NSData *(NSHTTPURLResponse *response, NSData *data) { + NSStringEncoding stringEncoding = NSUTF8StringEncoding; + if (response.textEncodingName) { + CFStringEncoding encoding = CFStringConvertIANACharSetNameToEncoding((CFStringRef)response.textEncodingName); + if (encoding != kCFStringEncodingInvalidId) { + stringEncoding = CFStringConvertEncodingToNSStringEncoding(encoding); + } + } + + NSString *string = [[NSString alloc] initWithData:data encoding:stringEncoding]; + if (success) { + string = success(response, string); + } + + return [string dataUsingEncoding:stringEncoding]; + } failure:failure]; +} + +- (void)loadRequest:(NSURLRequest *)request + MIMEType:(NSString *)MIMEType + textEncodingName:(NSString *)textEncodingName + progress:(NSProgress * _Nullable __autoreleasing * _Nullable)progress + success:(NSData * (^)(NSHTTPURLResponse *response, NSData *data))success + failure:(void (^)(NSError *error))failure +{ + NSParameterAssert(request); + + if (self.af_URLSessionTask.state == NSURLSessionTaskStateRunning || self.af_URLSessionTask.state == NSURLSessionTaskStateSuspended) { + [self.af_URLSessionTask cancel]; + } + self.af_URLSessionTask = nil; + + __weak __typeof(self)weakSelf = self; + NSURLSessionDataTask *dataTask; + dataTask = [self.sessionManager + GET:request.URL.absoluteString + parameters:nil + progress:nil + success:^(NSURLSessionDataTask * _Nonnull task, id _Nonnull responseObject) { + __strong __typeof(weakSelf) strongSelf = weakSelf; + if (success) { + success((NSHTTPURLResponse *)task.response, responseObject); + } + [strongSelf loadData:responseObject MIMEType:MIMEType textEncodingName:textEncodingName baseURL:[task.currentRequest URL]]; + + if ([strongSelf.delegate respondsToSelector:@selector(webViewDidStartLoad:)]) { + [strongSelf.delegate webViewDidFinishLoad:strongSelf]; + } + } + failure:^(NSURLSessionDataTask * _Nonnull task, NSError * _Nonnull error) { + if (failure) { + failure(error); + } + }]; + self.af_URLSessionTask = dataTask; + if (progress != nil) { + *progress = [self.sessionManager downloadProgressForTask:dataTask]; + } + [self.af_URLSessionTask resume]; + + if ([self.delegate respondsToSelector:@selector(webViewDidStartLoad:)]) { + [self.delegate webViewDidStartLoad:self]; + } +} + +@end + +#endif \ No newline at end of file diff --git a/its/plugin/projects/AFNetworking/fastlane/.env b/its/plugin/projects/AFNetworking/fastlane/.env new file mode 100644 index 00000000..46a98e83 --- /dev/null +++ b/its/plugin/projects/AFNetworking/fastlane/.env @@ -0,0 +1,10 @@ +AF_WORKSPACE="AFNetworking.xcworkspace" + +AF_IOS_FRAMEWORK_SCHEME="AFNetworking iOS" +AF_TVOS_FRAMEWORK_SCHEME="AFNetworking tvOS" +AF_OSX_FRAMEWORK_SCHEME="AFNetworking OS X" + +AF_IOS_EXAMPLE_SCHEME="iOS Example" +AF_TVOS_EXAMPLE_SCHEME="tvOS Example" +AF_OSX_EXAMPLE_SCHEME="OS X Example" + diff --git a/its/plugin/projects/AFNetworking/fastlane/.env.default b/its/plugin/projects/AFNetworking/fastlane/.env.default new file mode 100644 index 00000000..be94c17a --- /dev/null +++ b/its/plugin/projects/AFNetworking/fastlane/.env.default @@ -0,0 +1,15 @@ +AF_IOS_SDK=iphonesimulator9.2 +AF_MAC_SDK=macosx10.11 +AF_TVOS_SDK=appletvsimulator9.1 + +AF_CONFIGURATION=Release + +SCAN_WORKSPACE=$AF_WORKSPACE +SCAN_SCHEME=$AF_IOS_FRAMEWORK_SCHEME +SCAN_DESTINATION="OS=9.2,name=iPhone 6s" +SCAN_SDK=$AF_IOS_SDK +SCAN_OUTPUT_DIRECTORY=fastlane/test-output + +EXAMPLE_WORKSPACE=$AF_WORKSPACE +EXAMPLE_SCHEME=$AF_IOS_EXAMPLE_SCHEME +EXAMPLE_DESTINATION=$SCAN_DESTINATION \ No newline at end of file diff --git a/its/plugin/projects/AFNetworking/fastlane/.env.deploy b/its/plugin/projects/AFNetworking/fastlane/.env.deploy new file mode 100644 index 00000000..a123e622 --- /dev/null +++ b/its/plugin/projects/AFNetworking/fastlane/.env.deploy @@ -0,0 +1,14 @@ +DEPLOY_BRANCH=master +DEPLOY_PLIST_PATH=Framework/Info.plist +DEPLOY_PODSPEC=AFNetworking.podspec +DEPLOY_REMOTE=origin + +DEPLOY_CHANGELOG_PATH=CHANGELOG.md +DEPLOY_CHANGELOG_DELIMITER=--- + +# Used for CHANGELOG Generation and Github Release Management +GITHUB_OWNER=AFNetworking +GITHUB_REPOSITORY=AFNetworking +# CI Should Provide GITHUB_API_TOKEN + +CARTHAGE_FRAMEWORK_NAME=AFNetworking \ No newline at end of file diff --git a/its/plugin/projects/AFNetworking/fastlane/.env.ios81_xcode7 b/its/plugin/projects/AFNetworking/fastlane/.env.ios81_xcode7 new file mode 100644 index 00000000..fb6f3715 --- /dev/null +++ b/its/plugin/projects/AFNetworking/fastlane/.env.ios81_xcode7 @@ -0,0 +1,3 @@ +SCAN_DESTINATION="OS=8.1,name=iPhone 4S" +EXAMPLE_DESTINATION=$SCAN_DESTINATION +SCAN_SDK=iphonesimulator9.0 \ No newline at end of file diff --git a/its/plugin/projects/AFNetworking/fastlane/.env.ios83 b/its/plugin/projects/AFNetworking/fastlane/.env.ios83 new file mode 100644 index 00000000..0d6dca99 --- /dev/null +++ b/its/plugin/projects/AFNetworking/fastlane/.env.ios83 @@ -0,0 +1,2 @@ +SCAN_DESTINATION="OS=8.3,name=iPhone 5S" +EXAMPLE_DESTINATION=$SCAN_DESTINATION \ No newline at end of file diff --git a/its/plugin/projects/AFNetworking/fastlane/.env.ios84 b/its/plugin/projects/AFNetworking/fastlane/.env.ios84 new file mode 100644 index 00000000..5c20969d --- /dev/null +++ b/its/plugin/projects/AFNetworking/fastlane/.env.ios84 @@ -0,0 +1,2 @@ +SCAN_DESTINATION="OS=8.4,name=iPhone 6" +EXAMPLE_DESTINATION=$SCAN_DESTINATION \ No newline at end of file diff --git a/its/plugin/projects/AFNetworking/fastlane/.env.ios90_xcode7 b/its/plugin/projects/AFNetworking/fastlane/.env.ios90_xcode7 new file mode 100644 index 00000000..e89b458d --- /dev/null +++ b/its/plugin/projects/AFNetworking/fastlane/.env.ios90_xcode7 @@ -0,0 +1,3 @@ +SCAN_DESTINATION="OS=9.0,name=iPhone 6 Plus" +EXAMPLE_DESTINATION=$SCAN_DESTINATION +SCAN_SDK=iphonesimulator9.0 \ No newline at end of file diff --git a/its/plugin/projects/AFNetworking/fastlane/.env.ios91_xcode71 b/its/plugin/projects/AFNetworking/fastlane/.env.ios91_xcode71 new file mode 100644 index 00000000..5f8dd00c --- /dev/null +++ b/its/plugin/projects/AFNetworking/fastlane/.env.ios91_xcode71 @@ -0,0 +1,3 @@ +SCAN_DESTINATION="OS=9.1,name=iPhone 6s" +EXAMPLE_DESTINATION=$SCAN_DESTINATION +SCAN_SDK=iphonesimulator9.1 \ No newline at end of file diff --git a/its/plugin/projects/AFNetworking/fastlane/.env.ios92 b/its/plugin/projects/AFNetworking/fastlane/.env.ios92 new file mode 100644 index 00000000..67e5e829 --- /dev/null +++ b/its/plugin/projects/AFNetworking/fastlane/.env.ios92 @@ -0,0 +1,2 @@ +SCAN_DESTINATION="OS=9.2,name=iPhone 6s" +EXAMPLE_DESTINATION=$SCAN_DESTINATION \ No newline at end of file diff --git a/its/plugin/projects/AFNetworking/fastlane/.env.ios93_xcode73 b/its/plugin/projects/AFNetworking/fastlane/.env.ios93_xcode73 new file mode 100644 index 00000000..b0516eb0 --- /dev/null +++ b/its/plugin/projects/AFNetworking/fastlane/.env.ios93_xcode73 @@ -0,0 +1,3 @@ +SCAN_DESTINATION="OS=9.3,name=iPhone 6s" +EXAMPLE_DESTINATION=$SCAN_DESTINATION +SCAN_SDK=iphonesimulator9.3 \ No newline at end of file diff --git a/its/plugin/projects/AFNetworking/fastlane/.env.osx b/its/plugin/projects/AFNetworking/fastlane/.env.osx new file mode 100644 index 00000000..d56e363c --- /dev/null +++ b/its/plugin/projects/AFNetworking/fastlane/.env.osx @@ -0,0 +1,6 @@ +SCAN_SCHEME=$AF_OSX_FRAMEWORK_SCHEME +SCAN_DESTINATION="arch=x86_64" +SCAN_SDK=$AF_OSX_SDK + +EXAMPLE_SCHEME=$AF_OSX_EXAMPLE_SCHEME +EXAMPLE_DESTINATION=$SCAN_DESTINATION \ No newline at end of file diff --git a/its/plugin/projects/AFNetworking/fastlane/.env.tvos90_xcode71 b/its/plugin/projects/AFNetworking/fastlane/.env.tvos90_xcode71 new file mode 100644 index 00000000..98da9c0c --- /dev/null +++ b/its/plugin/projects/AFNetworking/fastlane/.env.tvos90_xcode71 @@ -0,0 +1,6 @@ +SCAN_SCHEME=$AF_TVOS_FRAMEWORK_SCHEME +SCAN_DESTINATION="OS=9.0,name=Apple TV 1080p" +SCAN_SDK=appletvsimulator9.0 + +EXAMPLE_SCHEME=$AF_TVOS_EXAMPLE_SCHEME +EXAMPLE_DESTINATION=$SCAN_DESTINATION \ No newline at end of file diff --git a/its/plugin/projects/AFNetworking/fastlane/.env.tvos91 b/its/plugin/projects/AFNetworking/fastlane/.env.tvos91 new file mode 100644 index 00000000..54cd02b3 --- /dev/null +++ b/its/plugin/projects/AFNetworking/fastlane/.env.tvos91 @@ -0,0 +1,6 @@ +SCAN_SCHEME=$AF_TVOS_FRAMEWORK_SCHEME +SCAN_DESTINATION="OS=9.1,name=Apple TV 1080p" +SCAN_SDK=$AF_TVOS_SDK + +EXAMPLE_SCHEME=$AF_TVOS_EXAMPLE_SCHEME +EXAMPLE_DESTINATION=$SCAN_DESTINATION \ No newline at end of file diff --git a/its/plugin/projects/AFNetworking/fastlane/Fastfile b/its/plugin/projects/AFNetworking/fastlane/Fastfile new file mode 100644 index 00000000..6a63d4c4 --- /dev/null +++ b/its/plugin/projects/AFNetworking/fastlane/Fastfile @@ -0,0 +1,337 @@ +# Customise this file, documentation can be found here: +# https://github.com/KrauseFx/fastlane/tree/master/docs +# All available actions: https://github.com/KrauseFx/fastlane/blob/master/docs/Actions.md +# can also be listed using the `fastlane actions` command + +# Change the syntax highlighting to Ruby +# All lines starting with a # are ignored when running `fastlane` + +# By default, fastlane will send which actions are used +# No personal data is shared, more information on https://github.com/fastlane/enhancer +# Uncomment the following line to opt out +# opt_out_usage + +# If you want to automatically update fastlane if a new version is available: +# update_fastlane + +# This is the minimum version number required. +# Update this, if you use features of a newer version +fastlane_version "1.37.0" +before_all do + # ENV["SLACK_URL"] = "https://hooks.slack.com/services/..." +end + +#Test Lanes +desc "Runs tests and builds example for the given environment" +desc "The lane to run by ci on every commit This lanes calls the lane `test_framework`." +desc "####Example:" +desc "```\nfastlane ci_commit configuration:Debug --env ios91\n```" +desc "####Options" +desc " * **`configuration`**: The build configuration to use. (`AF_CONFIGURATION`)" +desc "" +lane :ci_commit do |options| + if options[:configuration] + configuration = options[:configuration] + elsif ENV["AF_CONFIGURATION"] + configuration = ENV["AF_CONFIGURATION"] + else + configuration = "Release" + end + + test_framework(configuration: configuration) + + af_pod_spec_lint( + quick:true + ) +end + +desc "Runs all tests for the given environment" +desc "Set `scan` action environment variables to control test configuration" +desc "####Example:" +desc "```\nfastlane test_framework configuration:Debug --env ios91\n```" +desc "####Options" +desc " * **`configuration`**: The build configuration to use." +desc "" +lane :test_framework do |options| + scan( + configuration: options[:configuration] + ) + +end + +desc "Produces code coverage information" +desc "Set `scan` action environment variables to control test configuration" +desc "####Example:" +desc "```\nfastlane code_coverage configuration:Debug\n```" +desc "####Options" +desc " * **`configuration`**: The build configuration to use. The only supported configuration is the `Debug` configuration." +desc "" +lane :code_coverage do |options| + if options[:configuration] != "Debug" + Helper.log.info "Not running code coverage lane for #{options[:configuration]} configuration".yellow + else + scan( + configuration: options[:configuration], + xcargs: "OBJROOT=build GCC_GENERATE_TEST_COVERAGE_FILES=YES GCC_INSTRUMENT_PROGRAM_FLOW_ARCS=YES" + ) + end +end + + +#Deployment Lanes +desc "Prepares the framework for release" +desc "This lane should be run from your local machine, and will push a tag to the remote when finished." +desc " * Verifies the git branch is clean" +desc " * Ensures the lane is running on the master branch" +desc " * Verifies the Github milestone is ready for release" +desc " * Pulls the remote to verify the latest the branch is up to date" +desc " * Updates the version of the info plist path used by the framework" +desc " * Updates the the version of the podspec" +desc " * Generates a changelog based on the Github milestone" +desc " * Updates the changelog file" +desc " * Commits the changes" +desc " * Pushes the commited branch" +desc " * Creates a tag" +desc " * Pushes the tag" +desc "####Example:" +desc "```\nfastlane prepare_framework_release version:3.0.0 --env deploy\n```" +desc "####Options" +desc "It is recommended to manage these options through a .env file. See `fastlane/.env.deploy` for an example." +desc " * **`version`** (required): The new version of the framework" +desc " * **`allow_dirty_branch`**: Allows the git branch to be dirty before continuing. Defaults to false" +desc " * **`remote`**: The name of the git remote. Defaults to `origin`. (`DEPLOY_REMOTE`)" +desc " * **`allow_branch`**: The name of the branch to build from. Defaults to `master`. (`DEPLOY_BRANCH`)" +desc " * **`skip_validate_github_milestone`**: Skips validating a Github milestone. Defaults to false" +desc " * **`skip_git_pull`**: Skips pulling the git remote. Defaults to false" +desc " * **`skip_plist_update`**: Skips updating the version of the info plist. Defaults to false" +desc " * **`plist_path`**: The path of the plist file to update. (`DEPLOY_PLIST_PATH`)" +desc " * **`skip_podspec_update`**: Skips updating the version of the podspec. Defaults to false" +desc " * **`podspec`**: The path of the podspec file to update. (`DEPLOY_PODSPEC`)" +desc " * **`skip_changelog`**: Skip generating a changelog. Defaults to false." +desc " * **`changelog_path`**: The path to the changelog file. (`DEPLOY_CHANGELOG_PATH`)" +desc " * **`changelog_insert_delimiter`**: The delimiter to insert the changelog after. (`DEPLOY_CHANGELOG_DELIMITER`)" +desc "" + +lane :prepare_framework_release do |options| + if !options[:version] + raise "No version specified!".red + end + + #Ensure the branch is clean + if options[:allow_dirty_branch] != true + ensure_git_status_clean + end + + remote = options[:remote] ? options[:remote] : (ENV["DEPLOY_REMOTE"] ? ENV["DEPLOY_REMOTE"] : "origin") + allowed_branch = options[:allow_branch] ? options[:allow_branch] : (ENV["DEPLOY_BRANCH"] ? ENV["DEPLOY_BRANCH"] : "master") + + #Ensure we are on the right branch + ensure_git_branch( + branch:allowed_branch + ) + + #Verify the Github milestone is ready for release + if options[:skip_validate_github_milestone] != true + af_get_github_milestone( + title: options[:version], + verify_for_release:true + ) + end + + #Pull the latest to ensure we are up to date + if options[:skip_git_pull] != true + sh("git pull #{remote} #{allowed_branch}") + end + + #Update the framework plist + if options[:skip_plist_update] != true + plist_path = options[:plist_path] ? options[:plist_path] : ENV["DEPLOY_PLIST_PATH"] + set_info_plist_value( + path: plist_path, + key: "CFBundleVersion", + value: options[:version] + ) + end + + #Update the podspec + if options[:skip_podspec_update] != true + podspec = options[:podpsec] ? options[:podpsec] : ENV["DEPLOY_PODSPEC"] + version_bump_podspec( + path: podspec, + version_number: options[:version] + ) + + end + + #Generate a Changelog + if options[:skip_changelog] != true + changelog = af_generate_github_milestone_changelog( + milestone: options[:version] + ) + + Helper.log.info "Generated Changelog: #{changelog[:title]} #{changelog[:header]} #{changelog[:changelog]}" + + changelog_path = options[:changelog_path] ? options[:changelog_path] : ENV["DEPLOY_CHANGELOG_PATH"] + changelog_insert_delimiter = options[:changelog_insert_delimiter] ? options[:changelog_insert_delimiter] : ENV["DEPLOY_CHANGELOG_DELIMITER"] + af_insert_text_into_file( + file_path: changelog_path, + text: changelog[:title] + changelog[:header] + changelog[:changelog], + insert_delimiter: changelog_insert_delimiter + ) + end + + if prompt(text: "#{options[:version]} has been prepped for release. If you have any additional changes you would like to make to the README or CHANGELOG, please do those before continuing. Would you like to commit, tag, and push #{options[:version]} to #{remote}?".green, boolean: true,ci_input:"y") + + # commit the branch + git_commit( + path: ".", + message: "Preparing for the #{options[:version]} release" + ) + + #push the branch + push_to_git_remote( + remote: remote + ) + + # tag the repo + add_git_tag( + tag: "#{options[:version]}" + ) + + # push the tag + if options [:skip_push_tags] != true + af_push_git_tags_to_remote( + remote: remote + ) + end + + if !is_ci + notification( + title: "Release Preparation Complete", + message: "The tag #{options[:version]} is now available" + ) + end + + else + Helper.log.info "When finished, commit your changes and create your tag.".red + end +end + + +desc "Completes the framework release" +desc "This lane should be from a CI machine, after the tests have passed on the tag build. This lane does the following:" +desc " * Verifies the git branch is clean" +desc " * Ensures the lane is running on the master branch" +desc " * Pulls the remote to verify the latest the branch is up to date" +desc " * Generates a changelog for the Github Release" +desc " * Creates a Github Release" +desc " * Builds Carthage Frameworks" +desc " * Uploads Carthage Framework to Github Release" +desc " * Pushes podspec to pod trunk" +desc " * Lints the pod spec to ensure it is valid" +desc " * Closes the associated Github milestone" +desc "####Example:" +desc "```\nfastlane complete_framework_release --env deploy\n```" +desc "####Options" +desc "It is recommended to manage these options through a .env file. See `fastlane/.env.deploy` for an example." +desc " * **`version`** (required): The new version of the framework. Defaults to the last tag in the repo" +desc " * **`allow_dirty_branch`**: Allows the git branch to be dirty before continuing. Defaults to false" +desc " * **`remote`**: The name of the git remote. Defaults to `origin`. (`DEPLOY_REMOTE`)" +desc " * **`allow_branch`**: The name of the branch to build from. Defaults to `master`. (`DEPLOY_BRANCH`)" +desc " * **`skip_github_release`**: Skips creating a Github release. Defaults to false" +desc " * **`skip_carthage_framework`**: Skips creating a carthage framework. If building a swift framework, this should be disabled. Defaults to false." +desc " * **`skip_pod_push`**: Skips pushing the podspec to trunk." +desc " * **`skip_podspec_update`**: Skips updating the version of the podspec. Defaults to false" +desc " * **`skip_closing_github_milestone`**: Skips closing the associated Github milestone. Defaults to false" +desc "" +lane :complete_framework_release do |options| + if options[:skip_ci_check] != true + if !is_ci + raise "#{lane_context[SharedValues::LANE_NAME]} should be run from a CI machine. If you want to override this, pass 'skip_ci_check:true'".red + end + end + + version = options[:version] ? options[:version] : last_git_tag.strip + Helper.log.info "Using version #{version}" + + #Ensure clean branch + if options[:allow_dirty_branch] != true + ensure_git_status_clean + end + + remote = options[:remote] ? options[:remote] : (ENV["DEPLOY_REMOTE"] ? ENV["DEPLOY_REMOTE"] : "origin") + allowed_branch = options[:allow_branch] ? options[:allow_branch] : (ENV["DEPLOY_BRANCH"] ? ENV["DEPLOY_BRANCH"] : "master") + + #Ensure we are on the right branch + ensure_git_branch( + branch:allowed_branch + ) + + #Pull the latest to ensure we are up to date + if options[:skip_git_pull] != true + sh("git pull #{remote} #{allowed_branch}") + end + + # Create a release + #* Upload Notes + #* Upload Carthage Asset + if options[:skip_github_release] != true + af_generate_github_milestone_changelog( + milestone: version + ) + + body = lane_context[SharedValues::GITHUB_MILESTONE_CHANGELOG][:header] + lane_context[SharedValues::GITHUB_MILESTONE_CHANGELOG][:changelog] + af_create_github_release( + tag_name: version, + name: version, + body: body + ) + + # generate the carthage zip + if options[:skip_carthage_framework] != true + af_build_carthage_frameworks + + af_upload_asset_for_github_release( + file_path:lane_context[SharedValues::CARTHAGE_FRAMEWORK] + ) + + end + end + + #pod trunk push + if options[:skip_pod_push] != true + pod_push + + #pod spec lint + af_pod_spec_lint + end + + if options[:skip_closing_github_milestone] != true + af_get_github_milestone( + title: version + ) + + af_update_github_milestone( + state: "closed" + ) + end +end + + +after_all do |lane| + # This block is called, only if the executed lane was successful + + # slack( + # message: "Successfully deployed new App Update." + # ) +end + +error do |lane, exception| + # slack( + # message: exception.message, + # success: false + # ) +end + +# More information about multiple platforms in fastlane: https://github.com/KrauseFx/fastlane/blob/master/docs/Platforms.md +# All available actions: https://github.com/KrauseFx/fastlane/blob/master/docs/Actions.md diff --git a/its/plugin/projects/AFNetworking/fastlane/README.md b/its/plugin/projects/AFNetworking/fastlane/README.md new file mode 100644 index 00000000..f32f19ea --- /dev/null +++ b/its/plugin/projects/AFNetworking/fastlane/README.md @@ -0,0 +1,196 @@ +fastlane documentation +================ +# Installation +``` +sudo gem install fastlane +``` +# Available Actions +### ci_commit +``` +fastlane ci_commit +``` +Runs tests and builds example for the given environment + +The lane to run by ci on every commit This lanes calls the lane `test_framework`. + +####Example: + +``` +fastlane ci_commit configuration:Debug --env ios91 +``` + +####Options + + * **`configuration`**: The build configuration to use. (`AF_CONFIGURATION`) + + +### test_framework +``` +fastlane test_framework +``` +Runs all tests for the given environment + +Set `scan` action environment variables to control test configuration + +####Example: + +``` +fastlane test_framework configuration:Debug --env ios91 +``` + +####Options + + * **`configuration`**: The build configuration to use. + + +### code_coverage +``` +fastlane code_coverage +``` +Produces code coverage information + +Set `scan` action environment variables to control test configuration + +####Example: + +``` +fastlane code_coverage configuration:Debug +``` + +####Options + + * **`configuration`**: The build configuration to use. The only supported configuration is the `Debug` configuration. + + +### prepare_framework_release +``` +fastlane prepare_framework_release +``` +Prepares the framework for release + +This lane should be run from your local machine, and will push a tag to the remote when finished. + + * Verifies the git branch is clean + + * Ensures the lane is running on the master branch + + * Verifies the Github milestone is ready for release + + * Pulls the remote to verify the latest the branch is up to date + + * Updates the version of the info plist path used by the framework + + * Updates the the version of the podspec + + * Generates a changelog based on the Github milestone + + * Updates the changelog file + + * Commits the changes + + * Pushes the commited branch + + * Creates a tag + + * Pushes the tag + +####Example: + +``` +fastlane prepare_framework_release version:3.0.0 --env deploy +``` + +####Options + +It is recommended to manage these options through a .env file. See `fastlane/.env.deploy` for an example. + + * **`version`** (required): The new version of the framework + + * **`allow_dirty_branch`**: Allows the git branch to be dirty before continuing. Defaults to false + + * **`remote`**: The name of the git remote. Defaults to `origin`. (`DEPLOY_REMOTE`) + + * **`allow_branch`**: The name of the branch to build from. Defaults to `master`. (`DEPLOY_BRANCH`) + + * **`skip_validate_github_milestone`**: Skips validating a Github milestone. Defaults to false + + * **`skip_git_pull`**: Skips pulling the git remote. Defaults to false + + * **`skip_plist_update`**: Skips updating the version of the info plist. Defaults to false + + * **`plist_path`**: The path of the plist file to update. (`DEPLOY_PLIST_PATH`) + + * **`skip_podspec_update`**: Skips updating the version of the podspec. Defaults to false + + * **`podspec`**: The path of the podspec file to update. (`DEPLOY_PODSPEC`) + + * **`skip_changelog`**: Skip generating a changelog. Defaults to false. + + * **`changelog_path`**: The path to the changelog file. (`DEPLOY_CHANGELOG_PATH`) + + * **`changelog_insert_delimiter`**: The delimiter to insert the changelog after. (`DEPLOY_CHANGELOG_DELIMITER`) + + +### complete_framework_release +``` +fastlane complete_framework_release +``` +Completes the framework release + +This lane should be from a CI machine, after the tests have passed on the tag build. This lane does the following: + + * Verifies the git branch is clean + + * Ensures the lane is running on the master branch + + * Pulls the remote to verify the latest the branch is up to date + + * Generates a changelog for the Github Release + + * Creates a Github Release + + * Builds Carthage Frameworks + + * Uploads Carthage Framework to Github Release + + * Pushes podspec to pod trunk + + * Lints the pod spec to ensure it is valid + + * Closes the associated Github milestone + +####Example: + +``` +fastlane complete_framework_release --env deploy +``` + +####Options + +It is recommended to manage these options through a .env file. See `fastlane/.env.deploy` for an example. + + * **`version`** (required): The new version of the framework. Defaults to the last tag in the repo + + * **`allow_dirty_branch`**: Allows the git branch to be dirty before continuing. Defaults to false + + * **`remote`**: The name of the git remote. Defaults to `origin`. (`DEPLOY_REMOTE`) + + * **`allow_branch`**: The name of the branch to build from. Defaults to `master`. (`DEPLOY_BRANCH`) + + * **`skip_github_release`**: Skips creating a Github release. Defaults to false + + * **`skip_carthage_framework`**: Skips creating a carthage framework. If building a swift framework, this should be disabled. Defaults to false. + + * **`skip_pod_push`**: Skips pushing the podspec to trunk. + + * **`skip_podspec_update`**: Skips updating the version of the podspec. Defaults to false + + * **`skip_closing_github_milestone`**: Skips closing the associated Github milestone. Defaults to false + + + +---- + +This README.md is auto-generated and will be re-generated every time to run [fastlane](https://fastlane.tools). +More information about fastlane can be found on [https://fastlane.tools](https://fastlane.tools). +The documentation of fastlane can be found on [GitHub](https://github.com/fastlane/fastlane). \ No newline at end of file diff --git a/its/plugin/projects/AFNetworking/fastlane/actions/af_build_carthage_frameworks.rb b/its/plugin/projects/AFNetworking/fastlane/actions/af_build_carthage_frameworks.rb new file mode 100644 index 00000000..abe92c5a --- /dev/null +++ b/its/plugin/projects/AFNetworking/fastlane/actions/af_build_carthage_frameworks.rb @@ -0,0 +1,64 @@ +module Fastlane + module Actions + module SharedValues + CARTHAGE_FRAMEWORK = :CARTHAGE_FRAMEWORK + end + + # To share this integration with the other fastlane users: + # - Fork https://github.com/KrauseFx/fastlane + # - Clone the forked repository + # - Move this integration into lib/fastlane/actions + # - Commit, push and submit the pull request + + class AfBuildCarthageFrameworksAction < Action + def self.run(params) + + Actions.sh("carthage build --no-skip-current") + Actions.sh("carthage archive #{params[:framework_name]}") + + path = "#{params[:framework_name]}.framework.zip" + + Actions.lane_context[SharedValues::CARTHAGE_FRAMEWORK] = path + + Helper.log.info "Carthage generated #{params[:framework_name]}.framework" + + return path + end + + ##################################################### + # @!group Documentation + ##################################################### + + def self.description + "Create a Carthage Framework for your project" + end + + def self.available_options + [ + FastlaneCore::ConfigItem.new(key: :framework_name, + env_name: "CARTHAGE_FRAMEWORK_NAME", # The name of the environment variable + description: "The name of the framework for Carthage to generate", # a short description of this parameter + is_string:true) + ] + end + + def self.output + [ + ['CARTHAGE_FRAMEWORK', 'The path to the generate Carthage framework'] + ] + end + + def self.return_value + "The path to the zipped framework" + end + + def self.authors + ["kcharwood"] + end + + def self.is_supported?(platform) + return true + end + end + end +end diff --git a/its/plugin/projects/AFNetworking/fastlane/actions/af_create_github_release.rb b/its/plugin/projects/AFNetworking/fastlane/actions/af_create_github_release.rb new file mode 100644 index 00000000..14477dd4 --- /dev/null +++ b/its/plugin/projects/AFNetworking/fastlane/actions/af_create_github_release.rb @@ -0,0 +1,156 @@ +module Fastlane + module Actions + module SharedValues + GITHUB_RELEASE_ID = :GITHUB_RELEASE_ID + GITHUB_RELEASE_HTML_URL = :GITHUB_RELEASE_HTML_URL + GITHUB_RELEASE_UPLOAD_URL_TEMPLATE = :GITHUB_RELEASE_UPLOAD_URL_TEMPLATE + end + + # To share this integration with the other fastlane users: + # - Fork https://github.com/KrauseFx/fastlane + # - Clone the forked repository + # - Move this integration into lib/fastlane/actions + # - Commit, push and submit the pull request + + class AfCreateGithubReleaseAction < Action + def self.run(params) + require 'net/http' + require 'net/https' + require 'json' + require 'base64' + + begin + uri = URI("https://api.github.com/repos/#{params[:owner]}/#{params[:repository]}/releases") + + # Create client + http = Net::HTTP.new(uri.host, uri.port) + http.use_ssl = true + http.verify_mode = OpenSSL::SSL::VERIFY_PEER + + dict = Hash.new + dict["draft"] = params[:draft] + dict["prerelease"] = params[:prerelease] + dict["body"] = params[:body] if params[:body] + dict["tag_name"] = params[:tag_name] if params[:tag_name] + dict["name"] = params[:name] if params[:name] + body = JSON.dump(dict) + + # Create Request + req = Net::HTTP::Post.new(uri) + # Add headers + req.add_field "Content-Type", "application/json" + # Add headers + api_token = params[:api_token] + req.add_field "Authorization", "Basic #{Base64.strict_encode64(api_token)}" + # Add headers + req.add_field "Accept", "application/vnd.github.v3+json" + # Set header and body + req.add_field "Content-Type", "application/json" + req.body = body + + # Fetch Request + res = http.request(req) + rescue StandardError => e + Helper.log.info "HTTP Request failed (#{e.message})".red + end + + case res.code.to_i + when 201 + json = JSON.parse(res.body) + Helper.log.info "Github Release Created (#{json["id"]})".green + Helper.log.info "#{json["html_url"]}".green + + Actions.lane_context[SharedValues::GITHUB_RELEASE_ID] = json["id"] + Actions.lane_context[SharedValues::GITHUB_RELEASE_HTML_URL] = json["html_url"] + Actions.lane_context[SharedValues::GITHUB_RELEASE_UPLOAD_URL_TEMPLATE] = json["upload_url"] + return json + when 400..499 + json = JSON.parse(res.body) + raise "Error Creating Github Release (#{res.code}): #{json}".red + else + Helper.log.info "Status Code: #{res.code} Body: #{res.body}" + raise "Error Creating Github Release".red + end + end + + ##################################################### + # @!group Documentation + ##################################################### + + def self.description + "Create a Github Release" + end + + def self.available_options + [ + FastlaneCore::ConfigItem.new(key: :owner, + env_name: "GITHUB_OWNER", + description: "The Github Owner", + is_string:true, + optional:false), + FastlaneCore::ConfigItem.new(key: :repository, + env_name: "GITHUB_REPOSITORY", + description: "The Github Repository", + is_string:true, + optional:false), + FastlaneCore::ConfigItem.new(key: :api_token, + env_name: "GITHUB_API_TOKEN", + description: "Personal API Token for GitHub - generate one at https://github.com/settings/tokens", + is_string: true, + optional: false), + FastlaneCore::ConfigItem.new(key: :tag_name, + env_name: "GITHUB_RELEASE_TAG_NAME", + description: "Pass in the tag name", + is_string: true, + optional: false), + FastlaneCore::ConfigItem.new(key: :target_commitish, + env_name: "GITHUB_TARGET_COMMITISH", + description: "Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists", + is_string: true, + optional: true), + FastlaneCore::ConfigItem.new(key: :name, + env_name: "GITHUB_RELEASE_NAME", + description: "The name of the release", + is_string: true, + optional: true), + FastlaneCore::ConfigItem.new(key: :body, + env_name: "GITHUB_RELEASE_BODY", + description: "Text describing the contents of the tag", + is_string: true, + optional: true), + FastlaneCore::ConfigItem.new(key: :draft, + env_name: "GITHUB_RELEASE_DRAFT", + description: "true to create a draft (unpublished) release, false to create a published one", + is_string: false, + default_value: false), + FastlaneCore::ConfigItem.new(key: :prerelease, + env_name: "GITHUB_RELEASE_PRERELEASE", + description: "true to identify the release as a prerelease. false to identify the release as a full release", + is_string: false, + default_value: false), + + ] + end + + def self.output + [ + ['GITHUB_RELEASE_ID', 'The Github Release ID'], + ['GITHUB_RELEASE_HTML_URL', 'The Github Release URL'], + ['GITHUB_RELEASE_UPLOAD_URL_TEMPLATE', 'The Github Release Upload URL'] + ] + end + + def self.return_value + "The Hash representing the API response" + end + + def self.authors + ["kcharwood"] + end + + def self.is_supported?(platform) + return true + end + end + end +end diff --git a/its/plugin/projects/AFNetworking/fastlane/actions/af_edit_github_release.rb b/its/plugin/projects/AFNetworking/fastlane/actions/af_edit_github_release.rb new file mode 100644 index 00000000..731b776d --- /dev/null +++ b/its/plugin/projects/AFNetworking/fastlane/actions/af_edit_github_release.rb @@ -0,0 +1,161 @@ +module Fastlane + module Actions + module SharedValues + GITHUB_RELEASE_ID = :GITHUB_RELEASE_ID + GITHUB_RELEASE_HTML_URL = :GITHUB_RELEASE_HTML_URL + GITHUB_RELEASE_UPLOAD_URL_TEMPLATE = :GITHUB_RELEASE_UPLOAD_URL_TEMPLATE + end + + # To share this integration with the other fastlane users: + # - Fork https://github.com/KrauseFx/fastlane + # - Clone the forked repository + # - Move this integration into lib/fastlane/actions + # - Commit, push and submit the pull request + + class AfEditGithubReleaseAction < Action + def self.run(params) + + require 'net/http' + require 'net/https' + require 'json' + require 'base64' + + begin + uri = URI("https://api.github.com/repos/#{params[:owner]}/#{params[:repository]}/releases/#{params[:id]}") + + # Create client + http = Net::HTTP.new(uri.host, uri.port) + http.use_ssl = true + http.verify_mode = OpenSSL::SSL::VERIFY_PEER + + dict = Hash.new + dict["draft"] = params[:draft] if params[:draft] != nil + dict["prerelease"] = params[:prerelease] if params[:prerelease] != nil + dict["body"] = params[:body] if params[:body] + dict["tag_name"] = params[:tag_name] if params[:tag_name] + dict["name"] = params[:name] if params[:name] + body = JSON.dump(dict) + + # Create Request + req = Net::HTTP::Patch.new(uri) + # Add headers + req.add_field "Content-Type", "application/json" + # Add headers + api_token = params[:api_token] + req.add_field "Authorization", "Basic #{Base64.strict_encode64(api_token)}" + # Add headers + req.add_field "Accept", "application/vnd.github.v3+json" + # Set header and body + req.add_field "Content-Type", "application/json" + req.body = body + + # Fetch Request + res = http.request(req) + rescue StandardError => e + Helper.log.info "HTTP Request failed (#{e.message})".red + end + + case res.code.to_i + when 200 + json = JSON.parse(res.body) + Helper.log.info "Github Release updated".green + + Actions.lane_context[SharedValues::GITHUB_RELEASE_ID] = json["id"] + Actions.lane_context[SharedValues::GITHUB_RELEASE_HTML_URL] = json["html_url"] + Actions.lane_context[SharedValues::GITHUB_RELEASE_UPLOAD_URL_TEMPLATE] = json["upload_url"] + return json + when 400..499 + json = JSON.parse(res.body) + raise "Error Creating Github Release (#{res.code}): #{json["message"]}".red + else + Helper.log.info "Status Code: #{res.code} Body: #{res.body}" + raise "Error Creating Github Release".red + end + end + + ##################################################### + # @!group Documentation + ##################################################### + + def self.description + "Edit a Github Release" + end + + def self.available_options + [ + FastlaneCore::ConfigItem.new(key: :owner, + env_name: "GITHUB_OWNER", + description: "The Github Owner", + is_string:true, + optional:false), + FastlaneCore::ConfigItem.new(key: :repository, + env_name: "GITHUB_REPOSITORY", + description: "The Github Repository", + is_string:true, + optional:false), + FastlaneCore::ConfigItem.new(key: :id, + env_name: "GITHUB_RELEASE_ID", + description: "The Github Release ID", + is_string:true, + default_value:Actions.lane_context[SharedValues::GITHUB_RELEASE_ID]), + FastlaneCore::ConfigItem.new(key: :api_token, + env_name: "GITHUB_API_TOKEN", + description: "Personal API Token for GitHub - generate one at https://github.com/settings/tokens", + is_string: true, + optional: false), + FastlaneCore::ConfigItem.new(key: :tag_name, + env_name: "GITHUB_RELEASE_TAG_NAME", + description: "Pass in the tag name", + is_string: true, + optional: true), + FastlaneCore::ConfigItem.new(key: :target_commitish, + env_name: "GITHUB_TARGET_COMMITISH", + description: "Specifies the commitish value that determines where the Git tag is created from. Can be any branch or commit SHA. Unused if the Git tag already exists", + is_string: true, + optional: true), + FastlaneCore::ConfigItem.new(key: :name, + env_name: "GITHUB_RELEASE_NAME", + description: "The name of the release", + is_string: true, + optional: true), + FastlaneCore::ConfigItem.new(key: :body, + env_name: "GITHUB_RELEASE_BODY", + description: "Text describing the contents of the tag", + is_string: true, + optional: true), + FastlaneCore::ConfigItem.new(key: :draft, + env_name: "GITHUB_RELEASE_DRAFT", + description: "true to create a draft (unpublished) release, false to create a published one", + is_string: false, + optional: true), + FastlaneCore::ConfigItem.new(key: :prerelease, + env_name: "GITHUB_RELEASE_PRERELEASE", + description: "true to identify the release as a prerelease. false to identify the release as a full release", + is_string: false, + optional: true), + + ] + end + + def self.output + [ + ['GITHUB_RELEASE_ID', 'The Github Release ID'], + ['GITHUB_RELEASE_HTML_URL', 'The Github Release URL'], + ['GITHUB_RELEASE_UPLOAD_URL_TEMPLATE', 'The Github Release Upload URL'] + ] + end + + def self.return_value + "The Hash representing the API response" + end + + def self.authors + ["kcharwood"] + end + + def self.is_supported?(platform) + return true + end + end + end +end diff --git a/its/plugin/projects/AFNetworking/fastlane/actions/af_generate_github_milestone_changelog.rb b/its/plugin/projects/AFNetworking/fastlane/actions/af_generate_github_milestone_changelog.rb new file mode 100644 index 00000000..ca503b60 --- /dev/null +++ b/its/plugin/projects/AFNetworking/fastlane/actions/af_generate_github_milestone_changelog.rb @@ -0,0 +1,225 @@ +module Fastlane + module Actions + module SharedValues + GITHUB_MILESTONE_CHANGELOG = :GITHUB_MILESTONE_CHANGELOG + end + + # To share this integration with the other fastlane users: + # - Fork https://github.com/KrauseFx/fastlane + # - Clone the forked repository + # - Move this integration into lib/fastlane/actions + # - Commit, push and submit the pull request + + class AfGenerateGithubMilestoneChangelogAction < Action + def self.english_join(array = nil) + return "" if array.nil? or array.length == 0 + return array[0] if array.length == 1 + array[0..-2].join(", ") + " and " + array[-1] + end + + def self.markdown_for_changelog_section (github_owner, github_repository, api_token, section, issues) + changelog = "\n#### #{section}\n" + issues.each do |issue| + authors = getAuthorsForIssue(github_owner,github_repository, api_token, issue) + + changelog << "* #{issue["title"]}\n" + changelog << " * Implemented by #{english_join(authors)} in [##{issue["number"]}](#{issue["html_url"]}).\n" + end + return changelog + end + + def self.getResponseForURL(url, api_token) + uri = URI(url) + http = Net::HTTP.new(uri.host, uri.port) + http.use_ssl = true + http.verify_mode = OpenSSL::SSL::VERIFY_PEER + + # Create Request + req = Net::HTTP::Get.new(uri) + req.add_field "Authorization", "Basic #{Base64.strict_encode64(api_token)}" if api_token != nil + req.add_field "Accept", "application/vnd.github.v3+json" + begin + httpResponse = http.request(req) + begin + case httpResponse.code.to_i + when 200..299 + response = JSON.parse(httpResponse.body) + when 400..499 + response = JSON.parse(httpResponse.body) + raise "Error (#{response.code}): #{response["message"]}".red + else + Helper.log.info "Status Code: #{httpResponse.code} Body: #{httpResponse.body}" + raise "Error with request".red + end + + rescue + + end + rescue => ex + raise "Error fetching remote file: #{ex}".red + end + return response + end + + def self.getIssuesForMilestone (github_owner, github_repository, api_token, milestone) + url = "https://api.github.com/search/issues?q=repo:#{github_owner}/#{github_repository}+milestone:#{milestone}+state:closed" + + response = getResponseForURL(url, api_token) + return response["items"] + end + + def self.getAuthorsForIssue(github_owner, github_repository, api_token, issue) + if issue.has_key?("pull_request") + url = "https://api.github.com/repos/#{github_owner}/#{github_repository}/pulls/#{issue["number"]}/commits" + + commits = getResponseForURL(url, api_token) + + authors = Array.new + commits.each do |commit| + author = commit["commit"]["author"] + if authors.include?(author["name"]) == false + authors << author["name"] + end + end + return authors + else + return [issue["user"]["login"]] + end + end + + + def self.run(params) + require 'net/http' + require 'fileutils' + + issues = getIssuesForMilestone(params[:github_owner], params[:github_repository], params[:api_token], params[:milestone]) + + if issues.count == 0 && params[:allow_empty_changelog] == false + raise "No closed issues found for #{params[:milestone]} in #{params[:github_owner]}/#{params[:github_repository]}".red + end + + labels = [params[:added_label_name], params[:updated_label_name], params[:changed_label_name], params[:fixed_label_name], params[:removed_label_name]] + sections = Array.new + labels.each do |label_name| + subissues = issues.select {|issue| issue["labels"].any? {|label| label["name"].downcase == label_name.downcase}} + if subissues.count > 0 + sections << {section: label_name, issues: subissues} + issues = issues - subissues + end + end + + if issues.count > 0 + prompt_text = "There are #{issues.count} issue(s) that have not been properly categorized in this milestone. Do you want to continue?" + if Fastlane::Actions::PromptAction.run(text: prompt_text, boolean: true, ci_input: "y") + if sections.count > 0 + section_label = "Additional Changes" + else + section_label = "Changes" + end + sections << {section: section_label, issues: issues} + else + raise "Aborting since issues have not been categorized." + end + + end + + + date = DateTime.now + result = Hash.new + result[:title] = "\n\n## [#{params[:milestone]}](https://github.com/#{params[:github_owner]}/#{params[:github_repository]}/releases/tag/#{params[:milestone]}) (#{date.strftime("%m/%d/%Y")})" + result[:header] = "\nReleased on #{date.strftime("%A, %B %d, %Y")}. All issues associated with this milestone can be found using this [filter](https://github.com/#{params[:github_owner]}/#{params[:github_repository]}/issues?q=milestone%3A#{params[:milestone]}+is%3Aclosed)." + + result[:changelog] = "\n" + sections.each do |section| + result[:changelog] << markdown_for_changelog_section(params[:github_owner], params[:github_repository], params[:api_token], section[:section], section[:issues]) + end + Actions.lane_context[SharedValues::GITHUB_MILESTONE_CHANGELOG] = result + + return result + end + + ##################################################### + # @!group Documentation + ##################################################### + + def self.description + "Generate a markdown formatted change log for a specific milestone in a Github repository" + end + + def self.details + + "You can use this action to do cool things..." + end + + def self.available_options + [ + FastlaneCore::ConfigItem.new(key: :github_owner, + env_name: "GITHUB_OWNER", + description: "Github Owner for the repository", + is_string: true), + FastlaneCore::ConfigItem.new(key: :github_repository, + env_name: "GITHUB_REPOSITORY", + description: "Github Repository containing the milestone", + is_string: true), + FastlaneCore::ConfigItem.new(key: :api_token, + env_name: "GITHUB_API_TOKEN", + description: "Personal API Token for GitHub - generate one at https://github.com/settings/tokens", + is_string: true, + optional: true), + FastlaneCore::ConfigItem.new(key: :milestone, + env_name: "FL_GENERATE_GITHUB_MILESTONE_CHANGELOG_MILESTONE", + description: "Milestone to generate changelog notes", + is_string: true), + FastlaneCore::ConfigItem.new(key: :added_label_name, + env_name: "FL_GENERATE_GITHUB_MILESTONE_CHANGELOG_ADDED_LABEL_NAME", + description: "Github label name for all issues added during this milestone", + is_string: true, + default_value: "Added"), + FastlaneCore::ConfigItem.new(key: :updated_label_name, + env_name: "FL_GENERATE_GITHUB_MILESTONE_CHANGELOG_UPDATED_LABEL_NAME", + description: "Github label name for all issues updated during this milestone", + is_string: true, + default_value: "Updated"), + FastlaneCore::ConfigItem.new(key: :changed_label_name, + env_name: "FL_GENERATE_GITHUB_MILESTONE_CHANGELOG_CHANGED_LABEL_NAME", + description: "Github label name for all issues changed during this milestone", + is_string: true, + default_value: "Changed"), + FastlaneCore::ConfigItem.new(key: :fixed_label_name, + env_name: "FL_GENERATE_GITHUB_MILESTONE_CHANGELOG_FIXED_LABEL_NAME", + description: "Github label name for all issues fixed during this milestone", + is_string: true, + default_value: "Fixed"), + FastlaneCore::ConfigItem.new(key: :removed_label_name, + env_name: "FL_GENERATE_GITHUB_MILESTONE_CHANGELOG_REMOVED_LABEL_NAME", + description: "Github label name for all removed added during this milestone", + is_string: true, + default_value: "Removed"), + FastlaneCore::ConfigItem.new(key: :allow_empty_changelog, + env_name: "FL_GENERATE_GITHUB_MILESTONE_CHANGELOG_ALLOW_EMPTY", + description: "Flag which allows an empty changelog. If false, exception is raised if no issues are found", + is_string: false, + default_value: true) + ] + end + + def self.output + [ + ['GITHUB_MILESTONE_CHANGELOG', 'A hash containing a well formatted :header, and the :changelog itself'] + ] + end + + def self.return_value + "Returns a hash containing a well formatted :title, :header, and the :changelog itself, both in markdown" + end + + def self.authors + ["kcharwood"] + end + + def self.is_supported?(platform) + return true + end + end + end +end diff --git a/its/plugin/projects/AFNetworking/fastlane/actions/af_get_github_milestone.rb b/its/plugin/projects/AFNetworking/fastlane/actions/af_get_github_milestone.rb new file mode 100644 index 00000000..9ed273f4 --- /dev/null +++ b/its/plugin/projects/AFNetworking/fastlane/actions/af_get_github_milestone.rb @@ -0,0 +1,129 @@ +module Fastlane + module Actions + module SharedValues + GITHUB_MILESTONE_NUMBER = :GITHUB_MILESTONE_NUMBER + end + + # To share this integration with the other fastlane users: + # - Fork https://github.com/KrauseFx/fastlane + # - Clone the forked repository + # - Move this integration into lib/fastlane/actions + # - Commit, push and submit the pull request + + class AfGetGithubMilestoneAction < Action + def self.run(params) + require 'net/http' + require 'net/https' + require 'json' + require 'base64' + + begin + uri = URI("https://api.github.com/repos/#{params[:owner]}/#{params[:repository]}/milestones") + + # Create client + http = Net::HTTP.new(uri.host, uri.port) + http.use_ssl = true + http.verify_mode = OpenSSL::SSL::VERIFY_PEER + + # Create Request + req = Net::HTTP::Get.new(uri) + # Add headers + if params[:api_token] + api_token = params[:api_token] + req.add_field "Authorization", "Basic #{Base64.strict_encode64(api_token)}" + end + req.add_field "Accept", "application/vnd.github.v3+json" + + # Fetch Request + res = http.request(req) + rescue StandardError => e + Helper.log.info "HTTP Request failed (#{e.message})".red + end + + case res.code.to_i + when 200 + milestones = JSON.parse(res.body) + + milestone = milestones.select {|milestone| milestone["title"] == params[:title]}.first + + if milestone == nil + raise "No milestone found matching #{params[:title]}".red + end + + Helper.log.info "Milestone #{params[:title]}: #{milestone["url"]}".green + + if params[:verify_for_release] == true + raise "Milestone #{params[:title]} is already closed".red unless milestone["state"] == "open" + raise "Milestone #{params[:title]} still has open #{milestone["open_issues"]} issue(s)".red unless milestone["open_issues"] == 0 + raise "Milestone #{params[:title]} has no closed issues".red unless milestone["closed_issues"] > 0 + Helper.log.info "Milestone #{params[:title]} is ready for release!".green + end + + Actions.lane_context[SharedValues::GITHUB_MILESTONE_NUMBER] = milestone["number"] + return milestone + when 400..499 + json = JSON.parse(res.body) + raise "Error Retrieving Github Milestone (#{res.code}): #{json["message"]}".red + else + Helper.log.info "Status Code: #{res.code} Body: #{res.body}" + raise "Retrieving Github Milestone".red + end + + end + + ##################################################### + # @!group Documentation + ##################################################### + + def self.description + "Get a Github Milestone, and optional verify its ready for release" + end + + def self.available_options + [ + FastlaneCore::ConfigItem.new(key: :owner, + env_name: "GITHUB_OWNER", + description: "The Github Owner", + is_string:true, + optional:false), + FastlaneCore::ConfigItem.new(key: :repository, + env_name: "GITHUB_REPOSITORY", + description: "The Github Repository", + is_string:true, + optional:false), + FastlaneCore::ConfigItem.new(key: :api_token, + env_name: "GITHUB_API_TOKEN", + description: "Personal API Token for GitHub - generate one at https://github.com/settings/tokens", + is_string: true, + optional: true), + FastlaneCore::ConfigItem.new(key: :title, + description: "The milestone title, typically the same as the tag", + is_string: true, + optional: false), + FastlaneCore::ConfigItem.new(key: :verify_for_release, + description: "Verifies there are zero open issues, at least one closed issue, and is not closed", + is_string: false, + default_value:false) + ] + end + + def self.output + [ + ['GITHUB_MILESTONE_NUMBER', 'The milestone number'] + ] + end + + def self.return_value + "A Hash representing the API response" + end + + def self.authors + ["kcharwood"] + end + + def self.is_supported?(platform) + return true + end + end + end +end diff --git a/its/plugin/projects/AFNetworking/fastlane/actions/af_insert_text_into_file.rb b/its/plugin/projects/AFNetworking/fastlane/actions/af_insert_text_into_file.rb new file mode 100644 index 00000000..a308ff0d --- /dev/null +++ b/its/plugin/projects/AFNetworking/fastlane/actions/af_insert_text_into_file.rb @@ -0,0 +1,80 @@ +module Fastlane + module Actions + + # To share this integration with the other fastlane users: + # - Fork https://github.com/KrauseFx/fastlane + # - Clone the forked repository + # - Move this integration into lib/fastlane/actions + # - Commit, push and submit the pull request + class AfInsertTextIntoFileAction < Action + def self.replace(filepath, regexp, *args, &block) + content = File.read(filepath).gsub(regexp, *args, &block) + File.open(filepath, 'wb') { |file| file.write(content) } + end + + def self.run(params) + if params[:insert_delimiter] + replace(params[:file_path], /^#{params[:insert_delimiter]}/mi) do |match| + "#{match} #{params[:text]}" + end + elsif params[:insert_at_bottom] == true + open(params[:file_path], 'a') { |f| f.puts "#{params[:text]}" } + else + file = IO.read(params[:file_path]) + open(params[:file_path], 'w') { |f| f << params[:text] << file} + end + + Helper.log.info "#{params[:file_path]} has been updated".green + end + + ##################################################### + # @!group Documentation + ##################################################### + + def self.description + "Insert text into a file" + end + + def self.details + "Insert text at the top, bottom, or after a delimiter in a file" + end + + def self.available_options + [ + FastlaneCore::ConfigItem.new(key: :file_path, + description: "Path for the file", + is_string: true, + verify_block: proc do |value| + raise "Couldn't find file at path '#{value}'".red unless File.exist?(value) + end), + FastlaneCore::ConfigItem.new(key: :text, + description: "The text to insert", + is_string: true), + FastlaneCore::ConfigItem.new(key: :insert_delimiter, + description: "The delimiter indicating where to insert the text in the file", + is_string: true, + optional: true), + FastlaneCore::ConfigItem.new(key: :insert_at_bottom, + description: "If no 'insert_delimiter' is provided, the text will be appended to the bottom +of the file if this value is true, or to the top if this value is false", + is_string: false, + default_value: true), + ] + end + + def self.output + end + + def self.return_value + end + + def self.authors + ["kcharwood"] + end + + def self.is_supported?(platform) + return true + end + end + end +end diff --git a/its/plugin/projects/AFNetworking/fastlane/actions/af_pod_spec_lint.rb b/its/plugin/projects/AFNetworking/fastlane/actions/af_pod_spec_lint.rb new file mode 100644 index 00000000..7beef8a0 --- /dev/null +++ b/its/plugin/projects/AFNetworking/fastlane/actions/af_pod_spec_lint.rb @@ -0,0 +1,90 @@ +module Fastlane + module Actions + + # To share this integration with the other fastlane users: + # - Fork https://github.com/KrauseFx/fastlane + # - Clone the forked repository + # - Move this integration into lib/fastlane/actions + # - Commit, push and submit the pull request + + class AfPodSpecLintAction < Action + def self.run(params) + commands = ["pod", "spec", "lint"] + if params[:path] + commands << params[:path] + end + + if params[:quick] + commands << "--quick" + end + + if params[:allow_warnings] + commands << "--allow-warnings" + end + + if params[:no_subspecs] + commands << "--no-subspecs" + end + + if params[:subspec] + commands << "--subspec=#{params[:subspec]}" + end + + result = Actions.sh("#{commands.join(" ")}") + Helper.log.info "Successfully linted podspec".green + return result + end + + ##################################################### + # @!group Documentation + ##################################################### + + def self.description + "Lint a pod spec" + end + + def self.available_options + [ + FastlaneCore::ConfigItem.new(key: :path, + description: "The Podspec you want to lint", + optional: true, + verify_block: proc do |value| + raise "Couldn't find file at path '#{value}'".red unless File.exist?(value) + raise "File must be a `.podspec`".red unless value.end_with?(".podspec") + end), + FastlaneCore::ConfigItem.new(key: :quick, + description: "Lint skips checks that would require to download and build the spec", + optional: true, + is_string:false), + FastlaneCore::ConfigItem.new(key: :allow_warnings, + description: "Lint validates even if warnings are present", + optional: true, + is_string:false), + FastlaneCore::ConfigItem.new(key: :no_subspecs, + description: "Lint skips validation of subspecs", + optional: true, + is_string:false), + FastlaneCore::ConfigItem.new(key: :subspec, + description: "Lint validates only the given subspec", + optional: true, + is_string: true), + ] + end + + def self.output + end + + def self.return_value + # If you method provides a return value, you can describe here what it does + end + + def self.authors + ["kcharwood"] + end + + def self.is_supported?(platform) + platform != :android + end + end + end +end diff --git a/its/plugin/projects/AFNetworking/fastlane/actions/af_push_git_tags_to_remote.rb b/its/plugin/projects/AFNetworking/fastlane/actions/af_push_git_tags_to_remote.rb new file mode 100644 index 00000000..ed265dde --- /dev/null +++ b/its/plugin/projects/AFNetworking/fastlane/actions/af_push_git_tags_to_remote.rb @@ -0,0 +1,47 @@ +module Fastlane + module Actions + class AfPushGitTagsToRemoteAction < Action + def self.run(params) + commands = ["git", "push"] + + if params[:remote] + commands << "#{params[:remote]}" + end + + commands << "--tags" + + result = Actions.sh("#{commands.join(" ")}") + Helper.log.info "Tags pushed to remote".green + return result + end + + ##################################################### + # @!group Documentation + ##################################################### + + def self.description + "Push local tags to the remote - this will only push tags" + end + + def self.available_options + [ + FastlaneCore::ConfigItem.new(key: :remote, + env_name: "FL_PUSH_GIT_TAGS_REMOTE", + description: "The remote to push tags too", + is_string:true, + optional:true) + ] + end + + def self.author + ['vittoriom'] + end + + def self.is_supported?(platform) + true + end + end + end + end + + \ No newline at end of file diff --git a/its/plugin/projects/AFNetworking/fastlane/actions/af_update_github_milestone.rb b/its/plugin/projects/AFNetworking/fastlane/actions/af_update_github_milestone.rb new file mode 100644 index 00000000..8fa23c76 --- /dev/null +++ b/its/plugin/projects/AFNetworking/fastlane/actions/af_update_github_milestone.rb @@ -0,0 +1,138 @@ +module Fastlane + module Actions + module SharedValues + end + + # To share this integration with the other fastlane users: + # - Fork https://github.com/KrauseFx/fastlane + # - Clone the forked repository + # - Move this integration into lib/fastlane/actions + # - Commit, push and submit the pull request + + class AfUpdateGithubMilestoneAction < Action + def self.run(params) + + require 'net/http' + require 'net/https' + require 'json' + require 'base64' + + begin + uri = URI("https://api.github.com/repos/#{params[:owner]}/#{params[:repository]}/milestones/#{params[:number]}") + + # Create client + http = Net::HTTP.new(uri.host, uri.port) + http.use_ssl = true + http.verify_mode = OpenSSL::SSL::VERIFY_PEER + + dict = Hash.new + dict["title"] = params[:title] if params[:title] + dict["state"] = params[:state] if params[:state] + dict["description"] = params[:description] if params[:description] + dict["due_on"] = params[:due_on] if params[:due_on] + body = JSON.dump(dict) + + # Create Request + req = Net::HTTP::Patch.new(uri) + req.add_field "Content-Type", "application/json" + api_token = params[:api_token] + req.add_field "Authorization", "Basic #{Base64.strict_encode64(api_token)}" + req.add_field "Accept", "application/vnd.github.v3+json" + req.add_field "Content-Type", "application/json" + req.body = body + + # Fetch Request + res = http.request(req) + rescue StandardError => e + Helper.log.info "HTTP Request failed (#{e.message})".red + end + + case res.code.to_i + when 200 + json = JSON.parse(res.body) + Helper.log.info "Github Release updated".green + + Actions.lane_context[SharedValues::GITHUB_RELEASE_ID] = json["id"] + Actions.lane_context[SharedValues::GITHUB_RELEASE_HTML_URL] = json["html_url"] + Actions.lane_context[SharedValues::GITHUB_RELEASE_UPLOAD_URL_TEMPLATE] = json["upload_url"] + return json + when 400..499 + json = JSON.parse(res.body) + raise "Error Creating Github Release (#{res.code}): #{json["message"]}".red + else + Helper.log.info "Status Code: #{res.code} Body: #{res.body}" + raise "Error Creating Github Release".red + end + end + + ##################################################### + # @!group Documentation + ##################################################### + + def self.description + "Edit a Github Milestone" + end + + def self.available_options + [ + FastlaneCore::ConfigItem.new(key: :owner, + env_name: "GITHUB_OWNER", + description: "The Github Owner", + is_string:true, + optional:false), + FastlaneCore::ConfigItem.new(key: :repository, + env_name: "GITHUB_REPOSITORY", + description: "The Github Repository", + is_string:true, + optional:false), + FastlaneCore::ConfigItem.new(key: :number, + env_name: "GITHUB_MILESTONE_NUMBER", + description: "The Github Release ID", + is_string:true, + default_value:Actions.lane_context[SharedValues::GITHUB_MILESTONE_NUMBER]), + FastlaneCore::ConfigItem.new(key: :api_token, + env_name: "GITHUB_API_TOKEN", + description: "Personal API Token for GitHub - generate one at https://github.com/settings/tokens", + is_string: true, + optional: false), + FastlaneCore::ConfigItem.new(key: :title, + env_name: "GITHUB_MILESTONE_TITLE", + description: "The title to update", + is_string: true, + optional: true), + FastlaneCore::ConfigItem.new(key: :state, + env_name: "GITHUB_MILESTONE_STATE", + description: "The state to update. Can be `open` or `closed`", + is_string: true, + optional: true, + verify_block: proc do |value| + raise "`state` can only be `open` or `closed".red unless value == "open" || value == "closed" + end), + FastlaneCore::ConfigItem.new(key: :description, + env_name: "GITHUB_MILESTONE_DESCRIPTION", + description: "The description of the milestone", + is_string: true, + optional: true), + FastlaneCore::ConfigItem.new(key: :due_on, + env_name: "GITHUB_MIELSTONE_DUE_DATE", + description: "The milestone due date. This is a timestamp in ISO 8601 format: YYYY-MM-DDTHH:MM:SSZ", + is_string: true, + optional: true), + + ] + end + + def self.return_value + "The Hash representing the API response" + end + + def self.authors + ["kcharwood"] + end + + def self.is_supported?(platform) + return true + end + end + end +end diff --git a/its/plugin/projects/AFNetworking/fastlane/actions/af_upload_asset_for_github_release.rb b/its/plugin/projects/AFNetworking/fastlane/actions/af_upload_asset_for_github_release.rb new file mode 100644 index 00000000..900e3cfe --- /dev/null +++ b/its/plugin/projects/AFNetworking/fastlane/actions/af_upload_asset_for_github_release.rb @@ -0,0 +1,134 @@ +module Fastlane + module Actions + module SharedValues + GITHUB_UPLOAD_ASSET_URL = :GITHUB_UPLOAD_ASSET_URL + end + + # To share this integration with the other fastlane users: + # - Fork https://github.com/KrauseFx/fastlane + # - Clone the forked repository + # - Move this integration into lib/fastlane/actions + # - Commit, push and submit the pull request + + class AfUploadAssetForGithubReleaseAction < Action + def self.run(params) + require 'net/http' + require 'net/https' + require 'json' + require 'base64' + require 'addressable/template' + + begin + name = params[:name] ? params[:name] : File.basename(params[:file_path]) + expanded_url = Addressable::Template.new(params[:upload_url_template]).expand({name: name, label:params[:label]}).to_s + + uri = URI(expanded_url) + + # Create client + http = Net::HTTP.new(uri.host, uri.port) + http.use_ssl = true + http.verify_mode = OpenSSL::SSL::VERIFY_PEER + + + # Create Request + req = Net::HTTP::Post.new(uri) + # Add headers + req.add_field "Content-Type", params[:content_type] + # Add headers + api_token = params[:api_token] + req.add_field "Authorization", "Basic #{Base64.strict_encode64(api_token)}" + # Add headers + req.add_field "Accept", "application/vnd.github.v3+json" + # Set header and body + req.add_field "Content-Type", "application/json" + req.body = File.read(params[:file_path]) + + # Fetch Request + res = http.request(req) + rescue StandardError => e + Helper.log.info "HTTP Request failed (#{e.message})".red + end + + case res.code.to_i + when 201 + json = JSON.parse(res.body) + Helper.log.info "#{json["name"]} has been uploaded to the release".green + Actions.lane_context[SharedValues::GITHUB_UPLOAD_ASSET_URL] = json["browser_download_url"] + return json + when 400..499 + json = JSON.parse(res.body) + raise "Error Creating Github Release (#{res.code}): #{json}".red + else + Helper.log.info "Status Code: #{res.code} Body: #{res.body}" + raise "Error Creating Github Release".red + end + end + + ##################################################### + # @!group Documentation + ##################################################### + + def self.description + "Upload an asset to a Github Release" + end + + def self.available_options + # Define all options your action supports. + + # Below a few examples + [ + FastlaneCore::ConfigItem.new(key: :api_token, + env_name: "GITHUB_API_TOKEN", + description: "Personal API Token for GitHub - generate one at https://github.com/settings/tokens", + is_string: true, + optional: false), + FastlaneCore::ConfigItem.new(key: :upload_url_template, + env_name: "GITHUB_RELEASE_UPLOAD_URL_TEMPLATE", + description: "The Github Release Upload URL", + is_string:true, + default_value:Actions.lane_context[SharedValues::GITHUB_RELEASE_UPLOAD_URL_TEMPLATE]), + FastlaneCore::ConfigItem.new(key: :file_path, + env_name: "GITHUB_RELEASE_UPLOAD_FILE_PATH", + description: "Path for the file", + is_string: true, + verify_block: proc do |value| + raise "Couldn't find file at path '#{value}'".red unless File.exist?(value) + end), + FastlaneCore::ConfigItem.new(key: :name, + env_name: "GITHUB_RELEASE_UPLOAD_NAME", + description: "Name of the upload asset. Defaults to the base name of 'file_path'}", + is_string: true, + optional: true), + FastlaneCore::ConfigItem.new(key: :label, + env_name: "GITHUB_RELEASE_UPLOAD_LABEL", + description: "An alternate short description of the asset", + is_string: true, + optional: true), + FastlaneCore::ConfigItem.new(key: :content_type, + env_name: "GITHUB_RELEASE_UPLOAD_CONTENT_TYPE", + description: "The content type for the upload", + is_string: true, + default_value: "application/zip") + ] + end + + def self.output + [ + ['GITHUB_UPLOAD_ASSET_URL', 'A url for the newly created asset'] + ] + end + + def self.return_value + "The hash representing the API response" + end + + def self.authors + ["kcharwood"] + end + + def self.is_supported?(platform) + return true + end + end + end +end From de0fc8abbb49b6e4b0401004493267fbeb76c868 Mon Sep 17 00:00:00 2001 From: Matthew DeTullio Date: Thu, 14 Apr 2016 16:29:14 -0400 Subject: [PATCH 42/42] Add Clang core.CallAndMessage checker to rules definition. --- .../plugins/objectivec/clang/ClangRulesDefinition.java | 1 + .../org/sonar/plugins/objectivec/profile-clang.xml | 4 ++++ .../resources/org/sonar/plugins/objectivec/rules-clang.xml | 6 ++++++ 3 files changed, 11 insertions(+) diff --git a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java index d72d0c25..c225089c 100644 --- a/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java +++ b/sonar-objective-c-plugin/src/main/java/org/sonar/plugins/objectivec/clang/ClangRulesDefinition.java @@ -50,6 +50,7 @@ public final class ClangRulesDefinition implements RulesDefinition { .put("Missing call to superclass", "osx.cocoa.MissingSuperCall") // Core Foundation/Objective-C .put("Nil value used as mutex for @synchronized() (no synchronization will occur)", "osx.cocoa.AtSync") // Logic error .put("Result of operation is garbage or undefined", "core.UndefinedBinaryOperatorResult") // Logic error + .put("Uninitialized argument value", "core.CallAndMessage") // Logic error .build(); @Override diff --git a/sonar-objective-c-plugin/src/main/resources/org/sonar/plugins/objectivec/profile-clang.xml b/sonar-objective-c-plugin/src/main/resources/org/sonar/plugins/objectivec/profile-clang.xml index 1214c803..d5368d41 100644 --- a/sonar-objective-c-plugin/src/main/resources/org/sonar/plugins/objectivec/profile-clang.xml +++ b/sonar-objective-c-plugin/src/main/resources/org/sonar/plugins/objectivec/profile-clang.xml @@ -2,6 +2,10 @@ Clang objectivec + + clang + core.CallAndMessage + clang core.UndefinedBinaryOperatorResult diff --git a/sonar-objective-c-plugin/src/main/resources/org/sonar/plugins/objectivec/rules-clang.xml b/sonar-objective-c-plugin/src/main/resources/org/sonar/plugins/objectivec/rules-clang.xml index 2813133d..aebc0c83 100644 --- a/sonar-objective-c-plugin/src/main/resources/org/sonar/plugins/objectivec/rules-clang.xml +++ b/sonar-objective-c-plugin/src/main/resources/org/sonar/plugins/objectivec/rules-clang.xml @@ -1,4 +1,10 @@ + + core.CallAndMessage + Check for logical errors for function calls and Objective-C message expressions (e.g., uninitialized arguments, null function pointers) + CRITICAL + Check for logical errors for function calls and Objective-C message expressions (e.g., uninitialized arguments, null function pointers) + core.UndefinedBinaryOperatorResult Check for undefined results of binary operators