Compare commits

..

No commits in common. "master" and "0.4.2-beta" have entirely different histories.

28 changed files with 569 additions and 1281 deletions

View file

@ -1,37 +0,0 @@
version: 2
jobs:
build:
docker:
- image: circleci/openjdk:8-jdk
working_directory: ~/repo
environment:
JVM_OPTS: -Xmx3200m
TERM: dumb
steps:
- checkout
- restore_cache:
keys:
- kobalt-dependencies-{{ checksum "kobalt/src/Build.kt" }}
# fallback to using the latest cache if no exact match is found
- kobalt-dependencies-
- run:
name: Check Versions
command: ./kobaltw checkVersions
- save_cache:
paths: ~/.kobalt
key: kobalt-dependencies-{{ checksum "kobalt/src/Build.kt" }}
- run:
name: Assemble & Test
command: ./kobaltw assemble test
- store_artifacts:
path: kobaltBuild/test-output/
destination: test-output
- store_test_results:
path: kobaltBuild/test-output/

5
.gitattributes vendored
View file

@ -1,5 +0,0 @@
# Set the default behavior, in case people don't have core.autocrlf set.
* text=auto
# batch files are specific to windows and always crlf
*.bat eol=crlf

6
.gitignore vendored
View file

@ -4,9 +4,8 @@
**/.idea/tasks.xml **/.idea/tasks.xml
**/.idea/workspace.xml **/.idea/workspace.xml
*.iws *.iws
*.sublime-*
.classpath
.DS_Store .DS_Store
.classpath
.gradle .gradle
.kobalt .kobalt
.nb-gradle .nb-gradle
@ -19,13 +18,12 @@
/example/libs /example/libs
/gen /gen
/gradle.properties /gradle.properties
/libs
/out /out
/proguard-project.txt /proguard-project.txt
/project.properties /project.properties
/target /target
/test-output /test-output
Thumbs.db
ehthumbs.db ehthumbs.db
kobaltBuild kobaltBuild
local.properties local.properties
Thumbs.db

View file

@ -1,6 +0,0 @@
<component name="CopyrightManager">
<copyright>
<option name="myName" value="Erik's Copyright Notice" />
<option name="notice" value="&amp;#36;file.fileName&#10;&#10;Copyright (c) 2016-&amp;#36;today.year, Erik C. Thauvin (erik@thauvin.net)&#10;All rights reserved.&#10;&#10;Redistribution and use in source and binary forms, with or without&#10;modification, are permitted provided that the following conditions are met:&#10;&#10; Redistributions of source code must retain the above copyright notice, this&#10; list of conditions and the following disclaimer.&#10;&#10; Redistributions in binary form must reproduce the above copyright notice,&#10; this list of conditions and the following disclaimer in the documentation&#10; and/or other materials provided with the distribution.&#10;&#10; Neither the name of this project nor the names of its contributors may be&#10; used to endorse or promote products derived from this software without&#10; specific prior written permission.&#10;&#10;THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS &quot;AS IS&quot;&#10;AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE&#10;IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE&#10;DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE&#10;FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL&#10;DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR&#10;SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER&#10;CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,&#10;OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE&#10;OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." />
</copyright>
</component>

View file

@ -1,11 +1,3 @@
<component name="CopyrightManager"> <component name="CopyrightManager">
<settings default="Erik's Copyright Notice"> <settings default="" />
<module2copyright>
<element module="Copyright" copyright="Erik's Copyright Notice" />
</module2copyright>
<LanguageOptions name="Kotlin">
<option name="fileTypeOverride" value="3" />
<option name="addBlankAfter" value="false" />
</LanguageOptions>
</settings>
</component> </component>

2
.idea/kobalt.xml generated
View file

@ -5,7 +5,7 @@
<KobaltProjectSettings> <KobaltProjectSettings>
<option name="autoDownloadKobalt" value="true" /> <option name="autoDownloadKobalt" value="true" />
<option name="externalProjectPath" value="$PROJECT_DIR$" /> <option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="kobaltHome" value="$USER_HOME$/.kobalt/wrapper/dist/kobalt-1.0.87" /> <option name="kobaltHome" value="$USER_HOME$/.kobalt/wrapper/dist/kobalt-0.879" />
<option name="modules"> <option name="modules">
<set> <set>
<option value="$PROJECT_DIR$" /> <option value="$PROJECT_DIR$" />

7
.idea/kotlinc.xml generated
View file

@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="KotlinCommonCompilerArguments">
<option name="languageVersion" value="1.1" />
<option name="apiVersion" value="1.1" />
</component>
</project>

51
.idea/misc.xml generated
View file

@ -38,7 +38,56 @@
<property name="caretWidth" class="java.lang.Integer" /> <property name="caretWidth" class="java.lang.Integer" />
</properties> </properties>
</component> </component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8.x" project-jdk-type="JavaSDK"> <component name="EntryPointsManager">
<entry_points version="2.0" />
</component>
<component name="ProjectInspectionProfilesVisibleTreeState">
<entry key="Project Default">
<profile-state>
<expanded-state>
<State>
<id />
</State>
<State>
<id>Android Lint</id>
</State>
<State>
<id>Java</id>
</State>
<State>
<id>Portability issuesJava</id>
</State>
</expanded-state>
</profile-state>
</entry>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
<ConfirmationsSetting value="0" id="Remove" />
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.8.x" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/kobaltBuild/classes" /> <output url="file://$PROJECT_DIR$/kobaltBuild/classes" />
</component> </component>
<component name="masterDetails">
<states>
<state key="ProjectJDKs.UI">
<settings>
<last-edited>1.8.x</last-edited>
<splitter-proportions>
<option name="proportions">
<list>
<option value="0.19944212" />
</list>
</option>
</splitter-proportions>
</settings>
</state>
</states>
</component>
</project> </project>

View file

@ -1,3 +0,0 @@
<component name="DependencyValidationManager">
<scope name="Copyright" pattern="file[kobalt-versioneye]:src/main/kotlin//*.kt||file[kobalt-versioneye]:src/test/kotlin//*.kt" />
</component>

124
.idea/uiDesigner.xml generated
View file

@ -1,124 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

3
.idea/vcs.xml generated
View file

@ -2,8 +2,5 @@
<project version="4"> <project version="4">
<component name="VcsDirectoryMappings"> <component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" /> <mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component> </component>
</project> </project>

View file

@ -13,7 +13,4 @@ cache:
- $HOME/.m2 - $HOME/.m2
- $HOME/.kobalt - $HOME/.kobalt
before_cache: script: ./kobaltw clean assemble
- rm -rf .kobalt/*
script: ./kobaltw clean assemble test

View file

@ -1,4 +1,4 @@
Copyright (c) 2016-2017, Erik C. Thauvin (erik@thauvin.net) Copyright (c) 2016, Erik C. Thauvin (erik@thauvin.net)
All rights reserved. All rights reserved.
Redistribution and use in source and binary forms, with or without Redistribution and use in source and binary forms, with or without

View file

@ -1,8 +1,8 @@
# VersionEye plug-in for [Kobalt](http://beust.com/kobalt/home/index.html) # VersionEye plug-in for [Kobalt](http://beust.com/kobalt/home/index.html)
[![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](http://opensource.org/licenses/BSD-3-Clause) [![release](https://img.shields.io/github/release/ethauvin/kobalt-versioneye.svg)](https://github.com/ethauvin/kobalt-versioneye/releases/latest) [![Build Status](https://travis-ci.org/ethauvin/kobalt-versioneye.svg?branch=master)](https://travis-ci.org/ethauvin/kobalt-versioneye) [![CircleCI](https://circleci.com/gh/ethauvin/kobalt-versioneye/tree/master.svg?style=shield)](https://circleci.com/gh/ethauvin/kobalt-versioneye/tree/master) [![Download](https://api.bintray.com/packages/ethauvin/maven/kobalt-versioneye/images/download.svg) ](https://bintray.com/ethauvin/maven/kobalt-versioneye/_latestVersion) [![License (3-Clause BSD)](https://img.shields.io/badge/license-BSD%203--Clause-blue.svg?style=flat-square)](http://opensource.org/licenses/BSD-3-Clause) [![Build Status](https://travis-ci.org/ethauvin/kobalt-versioneye.svg?branch=master)](https://travis-ci.org/ethauvin/kobalt-versioneye) [![Download](https://api.bintray.com/packages/ethauvin/maven/kobalt-versioneye/images/download.svg) ](https://bintray.com/ethauvin/maven/kobalt-versioneye/_latestVersion)
[![VersionEye Logo](https://github.com/ethauvin/kobalt-versioneye/raw/master/src/site/images/VersionEyeLogo.png)](https://www.versioneye.com) [![VersionEye Logo](src/site/images/VersionEyeLogo.png)](https://www.versioneye.com)
The plug-in will create and update projects on [VersionEye](https://www.versioneye.com/), a service that notifies you about outdated dependencies, security vulnerabilities and license violations. The plug-in will create and update projects on [VersionEye](https://www.versioneye.com/), a service that notifies you about outdated dependencies, security vulnerabilities and license violations.
@ -11,9 +11,7 @@ To use the plug-in include the following in `Build.kt` file:
```kotlin ```kotlin
import net.thauvin.erik.kobalt.plugin.versioneye.* import net.thauvin.erik.kobalt.plugin.versioneye.*
val bs = buildScript { val pl = plugins("net.thauvin.erik:kobalt-versioneye:")
plugins("net.thauvin.erik:kobalt-versioneye:")
}
val p = project { val p = project {
name = "example" name = "example"
@ -30,7 +28,7 @@ val p = project {
To create or update your project on VersionEye, you will need an API key. If you are [signed up](https://www.versioneye.com/signup), you can find your API Key [here](https://www.versioneye.com/settings/api): To create or update your project on VersionEye, you will need an API key. If you are [signed up](https://www.versioneye.com/signup), you can find your API Key [here](https://www.versioneye.com/settings/api):
[![VersionEye API Key](https://github.com/ethauvin/kobalt-versioneye/raw/master/src/site/images/VersionEyeApiKey.png)](https://www.versioneye.com/settings/api) [![VersionEye API Key](src/site/images/VersionEyeApiKey.png)](https://www.versioneye.com/settings/api)
To create your project on VersionEye simply use your API Key as follows To create your project on VersionEye simply use your API Key as follows
@ -42,9 +40,9 @@ This will instruct the plug-in to create and update your project on VersionEye.
Upon running the above command the plug-in will output something like: Upon running the above command the plug-in will output something like:
![Example Report](src/site/images/ExampleReport.png) [![Example Report](src/site/images/ExampleReport.png)]
The report is based on the *Traffic Light* concept: The repot is based on the *Traffic Light* concept:
1. Green items are clear. 1. Green items are clear.
2. Yellow items may require some attention. 2. Yellow items may require some attention.
@ -90,17 +88,16 @@ versionEye {
The values are: The values are:
| Value | Description | Default | | Value | Description | Default |
| :----------- | :--------------------------------------------------------------------------------------------------------------------- | :---------------------------- | | :---------- | :---------------------------------------------------------------------------------------------- | :---------------------------- |
| `baseUrl` | For VersionEye Enterprise VM to use your own domain, e.g. `https://versioneye.my-company.com/` | `https://www.versioneye.com/` | | `baseUrl` | For VersionEye Enterprise VM to use their own url, e.g. `https://versioneye.my-company.com/` | `https://www.versioneye.com/` |
| `colors` | To enable (`true`) or disable (`false`) colors in the plug-in output. | `true` | | `colors` | To enable (`true`) or disable (`false`) colors in the plug-in output. | `true` |
| `name` | The name of the VersionEye project, if none is specified the Kobalt project name will be used. | *none* | | `name` | The name of the VersionEye project, if none are specified the Kobalt project name will be used. | *none* |
| `quiet` | To completely disable output from the plug-in. | `false` | | `quiet` | To completely disable output from the plug-in. | `false` |
| `org` | The VersionEye organization, if any. | *none* | | `org` | The VersionEye organisation, if any. | *none* |
| `pom` | Generate a [pom.xml](https://maven.apache.org/pom.html) for the project. See [Private vs. Public](#private-vs-public). | `false` | | `team` | The VersionEye team, if any. | *none* |
| `team` | The VersionEye team, if any. | *none* | | `vebose` | To enable or disable extra information in the plug-in output. | `true` |
| `verbose` | To enable or disable extra information in the plug-in output. | `true` | | `visbility` | To set the project's visibility on VersionEye, either `public` or `private` | `public` |
| `visibility` | To set the project's visibility on VersionEye, either `public` or `private` | `public` |
Some of the parameters can be controlled temporarily from the command line, as follows: Some of the parameters can be controlled temporarily from the command line, as follows:
@ -126,28 +123,5 @@ versionEye {
| :-------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | :-------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `Fail.dependenciesCheck` | Will triggered a failure on outdated dependencies. | | `Fail.dependenciesCheck` | Will triggered a failure on outdated dependencies. |
| `Fail.licensesUnknownCheck` | Will trigger a failure on unknown licenses. | | `Fail.licensesUnknownCheck` | Will trigger a failure on unknown licenses. |
| `Fail.licensesCheck` | Will trigger a failure on licenses whitelist violations. Licenses and components whitelists can be configured on the [VersionEye](https://www.versioneye.com/) website. | | `Fail.licensesCheck` | Will trigger a failure on licences whitelist violations. Licenses and components whitelists can be configured on the [VersionEye](https://www.versioneye.com/) website. |
| `Fail.securityCheck` | Will trigger a failure on known security vulnerabilities, on by default. | | `Fail.securityCheck` | Will trigger a failure on known security vulnerabilities, on by default. |
## Private vs. Public
By default, projects created using the VersionEye API are private. If your project is hosted on [GitHub](https://github.com) or [BitBucket](https://bitbucket.org) and would like to make it public on VersionEye. The plug-in can generate a [pom](https://maven.apache.org/pom.html) file compatible with VersionEye, as follows:
```
versionEye {
pom = true
...
}
```
and to generate the pom file, but **not** create a new project on VersionEye:
```bash
./kobaltw -Dve.create=false versionEye
```
Be sure to commit `pom.xml` on GitHub or BitBucket, and then import your project at:
* https://www.versioneye.com/projects/new
Finally, configure your [project key](#global-configuration).

View file

@ -1,37 +0,0 @@
#!/bin/bash
DEBUG=false
rm="rm -rf"
if [ "$DEBUG" = true ]; then
rm="echo rm -rf"
fi
buildkt="kobalt/src/Build.kt"
name=$(cat $buildkt | grep -m 1 "name = " | cut -d"\"" -f 2)
group=$(cat $buildkt | grep -m 1 "group = " | cut -d"\"" -f 2)
if [ -z "$1" ]; then
version=$(cat $buildkt | grep -m 1 "version = " | cut -d"\"" -f 2)
else
version="$1"
fi
maven="/k/maven/repository/${group//.//}/${name}/${version}"
kobalt="$HOME/.kobalt/cache/${group//.//}/${name}/${version}"
localRepo="$HOME/.kobalt/localMavenRepo/${group//.//}/${name}/${version}"
read -p "Delete version ${version}? " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
for dir in "$kobalt" "$maven" "$localRepo"; do
if [ -d "$dir" ]; then
echo -e "Deleting : \e[32;1m$dir\e[0m"
$rm "$dir"
else
echo -e "Not Found: \e[31;1m$dir\e[0m"
fi
done
fi

View file

@ -1,14 +1,13 @@
import com.beust.kobalt.* import com.beust.kobalt.*
import com.beust.kobalt.plugin.application.*
import com.beust.kobalt.plugin.packaging.* import com.beust.kobalt.plugin.packaging.*
import com.beust.kobalt.plugin.application.*
import com.beust.kobalt.plugin.kotlin.*
import net.thauvin.erik.kobalt.plugin.versioneye.* import net.thauvin.erik.kobalt.plugin.versioneye.*
// ./kobaltw versionEye val repos = repos()
val bs = buildScript { //val pl = plugins(file("../kobaltBuild/libs/kobalt-versioneye-0.4.2-beta.jar"))
repos(localMaven()) val pl = plugins("net.thauvin.erik:kobalt-versioneye:")
plugins("net.thauvin.erik:kobalt-versioneye:")
}
val p = project { val p = project {
@ -17,15 +16,25 @@ val p = project {
artifactId = name artifactId = name
version = "0.1" version = "0.1"
sourceDirectories {
path("src/main/kotlin")
}
sourceDirectoriesTest {
path("src/test/kotlin")
}
dependencies { dependencies {
compile("com.beust:jcommander:1.47") compile("com.beust:jcommander:1.47")
//compile("org.slf4j:slf4j-api:") //compile("org.slf4j:slf4j-api:")
compile("ch.qos.logback:logback-core:0.5") compile("ch.qos.logback:logback-core:0.5")
compile("ch.qos.logback:logback-classic:1.1.7") compile("ch.qos.logback:logback-classic:1.1.7")
compile("commons-httpclient:commons-httpclient:3.1") compile("commons-httpclient:commons-httpclient:jar:3.1")
compile("com.beust:kobalt-plugin-api:0.878") //compile("com.beust:kobalt-plugin-api:0.878")
} }
dependenciesTest { dependenciesTest {
compile("org.testng:testng:") compile("org.testng:testng:")
} }
@ -44,13 +53,11 @@ val p = project {
// colors = true // colors = true
// name = "" // name = ""
// org = "" // org = ""
pom = true
// quiet = false // quiet = false
// team = "" // team = ""
temp = true
// verbose = true // verbose = true
// visibility = "public" // visibility = "public"
//failOn(Fail.licensesUnknownCheck, Fail.licensesCheck, Fail.securityCheck, Fail.dependenciesCheck) //failOn(Fail.securityCheck)
} }
} }

View file

@ -1 +1 @@
kobalt.version=1.0.90 kobalt.version=0.879

View file

@ -1,43 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>example</artifactId>
<version>0.1</version>
<name>example</name>
<description></description>
<dependencies>
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
<version>1.47</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-core</artifactId>
<version>0.5</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.1.7</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>com.beust</groupId>
<artifactId>kobalt-plugin-api</artifactId>
<version>0.878</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>(0,]</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

File diff suppressed because it is too large Load diff

View file

@ -1,42 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module external.linked.project.id="Build.kt" external.linked.project.path="$MODULE_DIR$/.." external.root.project.path="$MODULE_DIR$/.." external.system.id="KOBALT" type="JAVA_MODULE" version="4"> <module version="4">
<component name="NewModuleRootManager"> <component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/out/classes" />
<output-test url="file://$MODULE_DIR$/out/test-classes" />
<exclude-output />
<content url="file://$MODULE_DIR$"> <content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> <sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
</content> </content>
<orderEntry type="inheritedJdk" /> <orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" /> <orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module-library"> <orderEntry type="library" name="KotlinJavaRuntime" level="project" />
<library name="Kobalt: kobalt-maven-local-0.5.3.jar"> <orderEntry type="library" name="kobalt.jar" level="project" />
<CLASSES>
<root url="jar://$USER_HOME$/.kobalt/cache/net/thauvin/erik/kobalt-maven-local/0.5.3/kobalt-maven-local-0.5.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="Kobalt: kobalt-versioneye-0.4.5.jar">
<CLASSES>
<root url="jar://$USER_HOME$/.kobalt/cache/net/thauvin/erik/kobalt-versioneye/0.4.5/kobalt-versioneye-0.4.5.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="module-library">
<library name="Kobalt: com.beust.kobalt:kobalt:jar:1.0.87">
<CLASSES>
<root url="jar://$USER_HOME$/.kobalt/wrapper/dist/kobalt-1.0.87/kobalt/wrapper/kobalt-1.0.87.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
<root url="jar://$USER_HOME$/.kobalt/wrapper/dist/kobalt-1.0.87/kobalt/wrapper/kobalt-1.0.87-sources.jar!/" />
</SOURCES>
</library>
</orderEntry>
</component> </component>
</module> </module>

View file

@ -1,30 +1,21 @@
import com.beust.kobalt.buildScript
import com.beust.kobalt.localMaven
import com.beust.kobalt.plugin.packaging.assemble import com.beust.kobalt.plugin.packaging.assemble
import com.beust.kobalt.plugin.publish.autoGitTag
import com.beust.kobalt.plugin.publish.bintray import com.beust.kobalt.plugin.publish.bintray
import com.beust.kobalt.profile
import com.beust.kobalt.project import com.beust.kobalt.project
import net.thauvin.erik.kobalt.plugin.versioneye.versionEye import com.beust.kobalt.repos
import org.apache.maven.model.Developer import org.apache.maven.model.Developer
import org.apache.maven.model.License import org.apache.maven.model.License
import org.apache.maven.model.Model import org.apache.maven.model.Model
import org.apache.maven.model.Scm import org.apache.maven.model.Scm
val bs = buildScript { val repos = repos()
repos(localMaven())
plugins("net.thauvin.erik:kobalt-maven-local:", "net.thauvin.erik:kobalt-versioneye:")
}
val dev by profile()
val kobaltDependency = if (dev) "kobalt" else "kobalt-plugin-api"
val p = project { val p = project {
name = "kobalt-versioneye" name = "kobalt-versioneye"
group = "net.thauvin.erik" group = "net.thauvin.erik"
artifactId = name artifactId = name
version = "0.4.6" version = "0.4.2-beta"
pom = Model().apply { pom = Model().apply {
description = "VersionEye plug-in for the Kobalt build system." description = "VersionEye plug-in for the Kobalt build system."
@ -45,41 +36,28 @@ val p = project {
}) })
} }
sourceDirectories {
path("src/main/kotlin")
}
sourceDirectoriesTest {
path("src/test/kotlin")
}
dependencies { dependencies {
compileOnly("com.beust:$kobaltDependency:") compile("com.beust:kobalt-plugin-api:0.878")
compile("org.jetbrains.kotlin:kotlin-stdlib:1.1.51")
compile("com.squareup.okhttp3:logging-interceptor:jar:3.9.0")
} }
dependenciesTest { dependenciesTest {
compile("org.testng:testng:6.12") compile("org.testng:testng:")
} }
assemble { assemble {
jar { mavenJars {}
fatJar = true
}
mavenJars {
fatJar = true
}
}
autoGitTag {
enabled = true
push = false
message = "Version $version"
} }
bintray { bintray {
publish = true publish = true
description = "Release version $version"
vcsTag = version
}
versionEye {
org = "thauvin"
team = "Owners"
pom = true
} }
} }

Binary file not shown.

View file

@ -1 +1 @@
kobalt.version=1.0.90 kobalt.version=0.879

42
pom.xml
View file

@ -1,42 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>net.thauvin.erik</groupId>
<artifactId>kobalt-versioneye</artifactId>
<version>0.4.6</version>
<name>kobalt-versioneye</name>
<description>VersionEye plug-in for the Kobalt build system.</description>
<url>https://github.com/ethauvin/kobalt-versioneye</url>
<licenses>
<license>
<name>BSD 3-Clause</name>
<url>https://opensource.org/licenses/BSD-3-Clause</url>
</license>
</licenses>
<developers>
<developer>
<id>ethauvin</id>
<name>Erik C. Thauvin</name>
<email>erik@thauvin.net</email>
</developer>
</developers>
<scm>
<connection>https://github.com/ethauvin/kobalt-versioneye.git</connection>
<developerConnection>git@github.com:ethauvin/kobalt-versioneye.git</developerConnection>
<url>https://github.com/ethauvin/kobalt-versioneye</url>
</scm>
<dependencies>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>logging-interceptor</artifactId>
<version>3.8.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.11</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View file

@ -1,7 +1,7 @@
/* /*
* VersionEyeUtils.kt * Utils.kt
* *
* Copyright (c) 2016-2017, Erik C. Thauvin (erik@thauvin.net) * Copyright (c) 2016, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -34,17 +34,8 @@ package net.thauvin.erik.kobalt.plugin.versioneye
import com.beust.kobalt.AsciiArt import com.beust.kobalt.AsciiArt
import com.beust.kobalt.misc.log import com.beust.kobalt.misc.log
open class VersionEyeUtils private constructor() { open class Utils {
companion object { companion object {
// Non-colors failure
fun alt(failed: Boolean): String {
if (failed) {
return " [FAILED]"
}
return ""
}
// Match failure option in set // Match failure option in set
fun isFail(failOn: Set<Fail>, match: Fail): Boolean { fun isFail(failOn: Set<Fail>, match: Fail): Boolean {
return failOn.contains(match) return failOn.contains(match)
@ -52,7 +43,7 @@ open class VersionEyeUtils private constructor() {
// Log text if applicable // Log text if applicable
fun log(text: StringBuilder, flag: Boolean, level: Int = 1) { fun log(text: StringBuilder, flag: Boolean, level: Int = 1) {
if (flag && text.isNotEmpty()) { if (flag && text.length > 0) {
log(level, text) log(level, text)
} }
} }
@ -67,27 +58,6 @@ open class VersionEyeUtils private constructor() {
} }
fun red(text: String, colors: Boolean = true): String {
if (!colors) {
return text
}
return AsciiArt.RED + text + AsciiArt.RESET
}
fun yellow(text: String, colors: Boolean = true): String {
if (!colors) {
return text
}
return AsciiArt.YELLOW + text + AsciiArt.RESET
}
fun green(text: String, colors: Boolean = true): String {
if (!colors) {
return text
}
return AsciiArt.GREEN + text + AsciiArt.RESET
}
fun redLight(count: Int, fail: Boolean, colors: Boolean): String { fun redLight(count: Int, fail: Boolean, colors: Boolean): String {
return redLight(count.toString(), count, fail, colors) return redLight(count.toString(), count, fail, colors)
} }
@ -96,11 +66,11 @@ open class VersionEyeUtils private constructor() {
fun redLight(text: String, count: Int, fail: Boolean, colors: Boolean): String { fun redLight(text: String, count: Int, fail: Boolean, colors: Boolean): String {
if (colors) { if (colors) {
if (fail && count > 0) { if (fail && count > 0) {
return red(text) return AsciiArt.RED + text + AsciiArt.RESET
} else if (count > 0) { } else if (count > 0) {
return yellow(text) return AsciiArt.YELLOW + text + AsciiArt.RESET
} else { } else {
return green(text) return AsciiArt.GREEN + text + AsciiArt.RESET
} }
} }
return text return text

View file

@ -1,7 +1,7 @@
/* /*
* VersionEyePlugin.kt * VersionEyePlugin.kt
* *
* Copyright (c) 2016-2017, Erik C. Thauvin (erik@thauvin.net) * Copyright (c) 2016, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved. * All rights reserved.
* *
* Redistribution and use in source and binary forms, with or without * Redistribution and use in source and binary forms, with or without
@ -44,8 +44,6 @@ import com.google.gson.JsonObject
import com.google.inject.Inject import com.google.inject.Inject
import com.google.inject.Singleton import com.google.inject.Singleton
import okhttp3.* import okhttp3.*
import okhttp3.logging.HttpLoggingInterceptor
import java.io.File
import java.io.FileOutputStream import java.io.FileOutputStream
import java.nio.file.Files import java.nio.file.Files
import java.nio.file.Paths import java.nio.file.Paths
@ -56,22 +54,13 @@ class VersionEyePlugin @Inject constructor(val configActor: ConfigActor<VersionE
val taskContributor: TaskContributor) : val taskContributor: TaskContributor) :
BasePlugin(), ITaskContributor, IConfigActor<VersionEyeConfig> by configActor { BasePlugin(), ITaskContributor, IConfigActor<VersionEyeConfig> by configActor {
private val API_KEY_PROPERTY = "versioneye.apiKey" private val API_KEY_PROPERTY = "versioneye.apiKey"
private val COLORS_PROPERTY = "ve.colors"
private val CREATE_PROPERTY = "ve.create"
private val PROJECT_KEY_PROPERTY = "versioneye.projectKey" private val PROJECT_KEY_PROPERTY = "versioneye.projectKey"
private val QUIET_PROPERTY = "ve.quiet" private val COLORS_PROPERTY = "ve.colors"
private val VERBOSE_PROPERTY = "ve.verbose" private val VERBOSE_PROPERTY = "ve.verbose"
private val QUIET_PROPERTY = "ve.quiet"
private val debug = System.getProperty("ve.debug", "false").toBoolean() private val debug = System.getProperty("ve.debug", "false").toBoolean()
private val proxy = System.getProperty("ve.proxy", "-1").toInt() private val httpClient = OkHttpClient()
private val httpClient = if (!debug) {
OkHttpClient()
} else {
OkHttpClient().newBuilder().addInterceptor(
HttpLoggingInterceptor({ message -> log(2, "[HTTP] $message") })
.apply { level = HttpLoggingInterceptor.Level.BODY }).build()
}
// ITaskContributor // ITaskContributor
override fun tasksFor(project: Project, context: KobaltContext): List<DynamicTask> = taskContributor.dynamicTasks override fun tasksFor(project: Project, context: KobaltContext): List<DynamicTask> = taskContributor.dynamicTasks
@ -90,15 +79,15 @@ class VersionEyePlugin @Inject constructor(val configActor: ConfigActor<VersionE
@Task(name = "versionEye", description = "Update and check dependencies on VersionEye") @Task(name = "versionEye", description = "Update and check dependencies on VersionEye")
fun versionEye(project: Project): TaskResult { fun versionEye(project: Project): TaskResult {
if (proxy != -1) { if (debug) {
log(1, " Using proxy 127.0.0.1:$proxy") log(1, " Using Fiddler proxy 127.0.0.1:8888")
System.setProperty("http.proxyHost", "127.0.0.1") System.setProperty("http.proxyHost", "127.0.0.1")
System.setProperty("https.proxyHost", "127.0.0.1") System.setProperty("https.proxyHost", "127.0.0.1")
System.setProperty("http.proxyPort", "$proxy") System.setProperty("http.proxyPort", "8888")
System.setProperty("https.proxyPort", "$proxy") System.setProperty("https.proxyPort", "8888")
} }
val local = "${project.directory}/local.properties" val local = project.directory + "/local.properties"
// Load configuration // Load configuration
configurationFor(project)?.let { config -> configurationFor(project)?.let { config ->
@ -135,25 +124,11 @@ class VersionEyePlugin @Inject constructor(val configActor: ConfigActor<VersionE
// Config parameters // Config parameters
config.colors = System.getProperty(COLORS_PROPERTY, config.colors.toString()).toBoolean() config.colors = System.getProperty(COLORS_PROPERTY, config.colors.toString()).toBoolean()
config.quiet = System.getProperty(QUIET_PROPERTY, config.quiet.toString()).toBoolean()
config.verbose = System.getProperty(VERBOSE_PROPERTY, config.verbose.toString()).toBoolean() config.verbose = System.getProperty(VERBOSE_PROPERTY, config.verbose.toString()).toBoolean()
config.quiet = System.getProperty(QUIET_PROPERTY, config.quiet.toString()).toBoolean()
// Get pom & proceed with update // Get pom & proceed with update
val pom = context.generatePom(project) val pom = context.generatePom(project)
// Write the pom
if (config.pom) {
File("pom.xml").writeText(pom)
// Don't create a new project
if (!System.getProperty(CREATE_PROPERTY, "true").toBoolean() && projectKey.isNullOrBlank()) {
log(1, " Be sure to commit pom.xml, and import your project at:")
log(1, VersionEyeUtils.yellow("\n\t${config.baseUrl}/projects/new\n", config.colors))
log(1, " Then configure your project key.")
return TaskResult()
}
}
val result = versionEyeUpdate(if (config.name.isNotBlank()) { val result = versionEyeUpdate(if (config.name.isNotBlank()) {
config.name config.name
} else { } else {
@ -162,7 +137,7 @@ class VersionEyePlugin @Inject constructor(val configActor: ConfigActor<VersionE
// Save properties // Save properties
FileOutputStream(local).use { output -> FileOutputStream(local).use { output ->
p.store(output, null) p.store(output, "")
} }
return result return result
@ -190,7 +165,7 @@ class VersionEyePlugin @Inject constructor(val configActor: ConfigActor<VersionE
val requestBody = MultipartBody.Builder() val requestBody = MultipartBody.Builder()
.setType(MultipartBody.FORM) .setType(MultipartBody.FORM)
.addFormDataPart("name", name) .addFormDataPart("name", name)
.addFormDataPart(filePartName, "$name.pom", .addFormDataPart(filePartName, "${config.name}.pom",
RequestBody.create(MediaType.parse("application/octet-stream"), pom)) RequestBody.create(MediaType.parse("application/octet-stream"), pom))
// Set organisation // Set organisation
@ -210,13 +185,15 @@ class VersionEyePlugin @Inject constructor(val configActor: ConfigActor<VersionE
} }
// Set visibility // Set visibility
if (config.visibility.isNotBlank() && config.visibility.equals("private", true)) { if (config.visibility.isNotBlank()) {
requestBody.addFormDataPart("visibility", "private") if (config.visibility.equals("private", true)) {
} else { requestBody.addFormDataPart("visibility", "private")
requestBody.addFormDataPart("visibility", "public") } else if (config.visibility.equals("public", true)) {
requestBody.addFormDataPart("visibility", "public")
}
} }
if (config.temp) { if (debug) {
requestBody.addFormDataPart("temp", "true") requestBody.addFormDataPart("temp", "true")
} }
@ -232,15 +209,16 @@ class VersionEyePlugin @Inject constructor(val configActor: ConfigActor<VersionE
// Execute and handle request // Execute and handle request
val response = httpClient.newCall(request).execute() val response = httpClient.newCall(request).execute()
// Parse json response
val o = GsonBuilder().create().fromJson(response.body().charStream(), JsonObject::class.java)
if (!response.isSuccessful) { if (!response.isSuccessful) {
// Parse json response warn("Unexpected response from VersionEye: " + response)
warn("Unexpected response from VersionEye: " + (o.get("error").asString ?: response.message()))
return TaskResult() return TaskResult()
} else { } else {
// Get & set project key // Parse json response
if (projectKey.isNullOrBlank() && !config.temp) { val builder = GsonBuilder()
val o = builder.create().fromJson(response.body().charStream(), JsonObject::class.java)
// Get project key
if (projectKey.isNullOrBlank()) {
projectKey = o.get("id").asString projectKey = o.get("id").asString
p.setProperty(PROJECT_KEY_PROPERTY, projectKey) p.setProperty(PROJECT_KEY_PROPERTY, projectKey)
} }
@ -253,10 +231,10 @@ class VersionEyePlugin @Inject constructor(val configActor: ConfigActor<VersionE
val sv_count = o.get("sv_count").asInt val sv_count = o.get("sv_count").asInt
// Sets deps, license and security failures // Sets deps, license and security failures
val isFailDeps = VersionEyeUtils.isFail(config.failSet, Fail.dependenciesCheck) && out_number > 0 val isFailDeps = Utils.isFail(config.failSet, Fail.dependenciesCheck)
val isFailLicense = VersionEyeUtils.isFail(config.failSet, Fail.licensesCheck) && licenses_red > 0 val isFailLicense = Utils.isFail(config.failSet, Fail.licensesCheck)
val isFailUnknown = VersionEyeUtils.isFail(config.failSet, Fail.licensesUnknownCheck) && licenses_unknown > 0 val isFailUnknown = Utils.isFail(config.failSet, Fail.licensesUnknownCheck)
val isFailSecurity = VersionEyeUtils.isFail(config.failSet, Fail.securityCheck) && sv_count > 0 val isFailSecurity = Utils.isFail(config.failSet, Fail.securityCheck)
// Unknown dependencies // Unknown dependencies
var unknownDeps = 0 var unknownDeps = 0
@ -280,14 +258,14 @@ class VersionEyePlugin @Inject constructor(val configActor: ConfigActor<VersionE
depsInfo.append(lf) depsInfo.append(lf)
} }
unknownDeps++ unknownDeps++
depsInfo.append(VersionEyeUtils.redLight(" - $depName -> UNKNOWN", unknownDeps, false, config.colors)) depsInfo.append(
Utils.redLight(" - $depName -> UNKNOWN", unknownDeps, false, config.colors))
} else if (dep.get("outdated").asBoolean) { } else if (dep.get("outdated").asBoolean) {
if (depsInfo.isNotEmpty()) { if (depsInfo.isNotEmpty()) {
depsInfo.append(lf) depsInfo.append(lf)
} }
depsInfo.append(VersionEyeUtils.redLight(" - $depName -> " depsInfo.append(Utils.redLight(" - $depName -> "
+ curVer.asString, out_number, isFailDeps, config.colors) + curVer.asString, out_number, isFailDeps, config.colors))
+ VersionEyeUtils.alt(isFailDeps && !config.colors))
} }
// Parse licenses // Parse licenses
@ -300,10 +278,10 @@ class VersionEyePlugin @Inject constructor(val configActor: ConfigActor<VersionE
val onWhitelist = license.get("on_whitelist") val onWhitelist = license.get("on_whitelist")
val onCwl = license.get("on_cwl") val onCwl = license.get("on_cwl")
if (!onWhitelist.isJsonNull) { if (!onWhitelist.isJsonNull) {
if (onWhitelist.asString == "false") { if (onWhitelist.asString.equals("false")) {
if (onCwl.isJsonNull) { if (onCwl.isJsonNull) {
whitelisted++ whitelisted++
} else if (onCwl.toString() != "true") { } else if (!onCwl.toString().equals("true")) {
whitelisted++ whitelisted++
} }
} }
@ -318,9 +296,8 @@ class VersionEyePlugin @Inject constructor(val configActor: ConfigActor<VersionE
if (licensesInfo.isNotEmpty()) { if (licensesInfo.isNotEmpty()) {
licensesInfo.append(lf) licensesInfo.append(lf)
} }
licensesInfo.append(VersionEyeUtils.redLight(" - $depName: $whitelisted whitelist " licensesInfo.append(Utils.redLight(" - $depName: $whitelisted whitelist "
+ VersionEyeUtils.plural("violation", whitelisted, "s"), whitelisted, isFailLicense, config.colors) + Utils.plural("violation", whitelisted, "s"), whitelisted, isFailLicense, config.colors))
+ VersionEyeUtils.alt(isFailLicense && !config.colors))
} }
// Unknowns // Unknowns
@ -328,60 +305,61 @@ class VersionEyePlugin @Inject constructor(val configActor: ConfigActor<VersionE
if (licensesInfo.isNotEmpty()) { if (licensesInfo.isNotEmpty()) {
licensesInfo.append(lf) licensesInfo.append(lf)
} }
licensesInfo.append(VersionEyeUtils.redLight(" - $depName: $unknowns " licensesInfo.append(Utils.redLight(" - $depName: $unknowns "
+ VersionEyeUtils.plural("unknown license", unknowns, "s"), unknowns, isFailUnknown, config.colors) + Utils.plural("unknown license", unknowns, "s"), unknowns, isFailUnknown, config.colors))
+ VersionEyeUtils.alt(isFailUnknown && !config.colors))
} }
// Security vulnerabilities // Security vulnerabilities
val security = dep.get("security_vulnerabilities") val security = dep.get("security_vulnerabilities")
if (!security.isJsonNull) { if (!security.isJsonNull) {
if (securityInfo.isNotEmpty()) { if (securityInfo.length > 0) {
securityInfo.append(lf) securityInfo.append(lf)
} }
val count = security.asJsonArray.size() val count = security.asJsonArray.size()
securityInfo.append(VersionEyeUtils.redLight(" - $depName: $count " securityInfo.append(Utils.redLight(" - $depName: $count "
+ VersionEyeUtils.plural("known issue", count, "s"), count, isFailSecurity, config.colors) + Utils.plural("known issue", count, "s"), count, isFailSecurity, config.colors))
+ VersionEyeUtils.alt(isFailSecurity && !config.colors))
} }
} }
// Non-verbose failure // Non-verbose failure
val verbose = (KobaltLogger.LOG_LEVEL > 1 || config.verbose) val verbose = (KobaltLogger.LOG_LEVEL > 1 || config.verbose)
val alt = " [FAILED]"
// Log dependencies check results // Log dependencies check results
log(1, " Dependencies: " log(1, " Dependencies: "
+ VersionEyeUtils.redLight(out_number, isFailDeps, config.colors) + " outdated. " + Utils.redLight(out_number, isFailDeps, config.colors) + " outdated. "
+ VersionEyeUtils.redLight(unknownDeps, false, config.colors) + " unknown. $dep_number total." + Utils.redLight(unknownDeps, false, config.colors) + " unknown. $dep_number total."
+ VersionEyeUtils.alt(isFailDeps && !config.colors)) + if (isFailDeps && !config.colors) alt else "")
VersionEyeUtils.log(depsInfo, verbose) Utils.log(depsInfo, verbose)
// Log licenses check results // Log licenses check results
log(1, " Licenses: " log(1, " Licenses: "
+ VersionEyeUtils.redLight(licenses_red, isFailLicense, config.colors) + " whitelist. " + Utils.redLight(licenses_red, isFailLicense, config.colors)
+ VersionEyeUtils.redLight(licenses_unknown, isFailUnknown, config.colors) + " whitelist. "
+ VersionEyeUtils.plural(" unknown", licenses_unknown, "s.", ".") + Utils.redLight(licenses_unknown, isFailUnknown, config.colors)
+ VersionEyeUtils.alt((isFailLicense || isFailUnknown) && !config.colors)) + Utils.plural(" unknown", licenses_unknown, "s.", ".")
VersionEyeUtils.log(licensesInfo, verbose) + if ((isFailLicense || isFailUnknown) && !config.colors) alt else "")
Utils.log(licensesInfo, verbose)
// Log security check results // Log security check results
log(1, " Security: " log(1, " Security: "
+ VersionEyeUtils.redLight(sv_count, isFailSecurity, config.colors) + Utils.redLight(sv_count, isFailSecurity, config.colors)
+ ' ' + ' '
+ VersionEyeUtils.plural("vulnerabilit", sv_count, "ies.", "y.") + Utils.plural("vulnerabilit", sv_count, "ies.", "y.")
+ VersionEyeUtils.alt(isFailSecurity && !config.colors)) + if (isFailSecurity && !config.colors) alt else "")
VersionEyeUtils.log(securityInfo, verbose) Utils.log(securityInfo, verbose)
// Show project url // Show project url
if (!config.temp) { val baseUrl = if (config.baseUrl.endsWith('/')) config.baseUrl else config.baseUrl + '/'
val baseUrl = if (config.baseUrl.endsWith('/')) config.baseUrl else config.baseUrl + '/' log(1, " View more at: ${baseUrl}user/projects/$projectKey")
log(1, " View more at: ${baseUrl}user/projects/$projectKey")
}
} }
// Task failure // Task failure
if (isFailDeps || isFailLicense || isFailUnknown || isFailSecurity) { if (out_number > 0 && isFailDeps
|| licenses_red > 0 && isFailLicense
|| licenses_unknown > 0 && isFailUnknown
|| sv_count > 0 && isFailSecurity) {
return TaskResult(false) return TaskResult(false)
} }
} }
@ -394,29 +372,27 @@ enum class Fail {
} }
@Directive @Directive
class VersionEyeConfig { class VersionEyeConfig() {
var baseUrl = "https://www.versioneye.com/" var baseUrl = "https://www.versioneye.com/"
var colors = true var colors = true
val failSet: MutableSet<Fail> = mutableSetOf(Fail.securityCheck) val failSet: MutableSet<Fail> = mutableSetOf(Fail.securityCheck)
var name = "" var name = ""
var org = "" var org = ""
var pom = false
var quiet = false var quiet = false
var team = "" var team = ""
var temp = false
var verbose = true var verbose = true
var visibility = "public" var visibility = "public"
@Suppress("unused")
fun failOn(vararg args: Fail) { fun failOn(vararg args: Fail) {
if (failSet.isNotEmpty()) { if (failSet.isNotEmpty()) {
failSet.clear() failSet.clear()
} }
failSet.addAll(args) args.forEach {
failSet.add(it)
}
} }
} }
@Suppress("unused")
@Directive @Directive
fun Project.versionEye(init: VersionEyeConfig.() -> Unit) { fun Project.versionEye(init: VersionEyeConfig.() -> Unit) {
VersionEyeConfig().let { config -> VersionEyeConfig().let { config ->

View file

@ -1,103 +0,0 @@
/*
* VersionEyeUtilsTest.kt
*
* Copyright (c) 2016-2017, Erik C. Thauvin (erik@thauvin.net)
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
*
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* Neither the name of this project nor the names of its contributors may be
* used to endorse or promote products derived from this software without
* specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.thauvin.erik.kobalt.plugin.versioneye
import com.beust.kobalt.AsciiArt
import org.testng.Assert
import org.testng.annotations.Test
@Test
class VersionEyeUtilsTest {
val text = "This is a test"
@Test
fun alt() {
Assert.assertEquals(VersionEyeUtils.alt(false), "", "alt(false")
Assert.assertEquals(VersionEyeUtils.alt(true), " [FAILED]", "alt(true)")
}
@Test
fun plural() {
val singular = "foo"
val plural = "s"
Assert.assertEquals(VersionEyeUtils.plural(singular, 0, plural), singular, "plural($singular, count:0, $plural)")
Assert.assertEquals(VersionEyeUtils.plural(singular, 1, plural), singular, "plural($singular, count:1, $plural)")
Assert.assertEquals(VersionEyeUtils.plural(singular, 2, plural), singular + plural, "plural($singular, count:2," +
"$plural)")
val text = "vulnerabilit"
val y = "y"
val ies = "ies"
Assert.assertEquals(VersionEyeUtils.plural(text, 0, ies, y), text + y, "plural($text, count:0, $ies, $y)")
Assert.assertEquals(VersionEyeUtils.plural(text, 1, ies, y), text + y, "plural($text, count:1, $ies, $y)")
Assert.assertEquals(VersionEyeUtils.plural(text, 2, ies, y), text + ies, "plural($text, count:2, $ies, $y)")
}
@Test
fun red() {
Assert.assertEquals(VersionEyeUtils.red(text), AsciiArt.RED + text + AsciiArt.RESET, "red($text)")
Assert.assertEquals(VersionEyeUtils.red(text, false), text, "red($text)")
}
@Test
fun yellow() {
Assert.assertEquals(VersionEyeUtils.yellow(text), AsciiArt.YELLOW + text + AsciiArt.RESET, "yellow($text)")
Assert.assertEquals(VersionEyeUtils.yellow(text, false), text, "yellow($text)")
}
@Test
fun green() {
Assert.assertEquals(VersionEyeUtils.green(text), AsciiArt.GREEN + text + AsciiArt.RESET, "green($text)")
Assert.assertEquals(VersionEyeUtils.green(text, false), text, "green($text)")
}
@Test
fun redLight() {
Assert.assertEquals(VersionEyeUtils.redLight(text, 1, true, true), AsciiArt.RED + text + AsciiArt.RESET,
"redLight($text, count:1, fail:true, colors:true)")
Assert.assertEquals(VersionEyeUtils.redLight(text, 1, false, true), AsciiArt.YELLOW + text + AsciiArt.RESET,
"redLight($text, count:1, fail:false, colors:true)")
Assert.assertEquals(VersionEyeUtils.redLight(text, 0, false, true), AsciiArt.GREEN + text + AsciiArt.RESET,
"redLight($text, count:0, fail:false, colors:true)")
Assert.assertEquals(VersionEyeUtils.redLight(text, 1, false, false), text,
"redLight($text, count:1, fail:false, colors:false)")
Assert.assertEquals(VersionEyeUtils.redLight(1, true, true), AsciiArt.RED + 1 + AsciiArt.RESET,
"redLight(count:1, fail:true, colors:true)")
Assert.assertEquals(VersionEyeUtils.redLight(1, false, true), AsciiArt.YELLOW + 1 + AsciiArt.RESET,
"redLight(count:1, fail:false, colors:true)")
Assert.assertEquals(VersionEyeUtils.redLight(0, false, true), AsciiArt.GREEN + 0 + AsciiArt.RESET,
"redLight(count:0, fail:false, colors:true)")
Assert.assertEquals(VersionEyeUtils.redLight(1, false, false), "1",
"redLight(count:1, fail:false, colors:false)")
}
}