b/159618326 Plugins and dependencies initial configuration Change-Id: Ic5021625f5fdfd61ef55c0f2f64a71eaf03e8775
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d1d4fe8 --- /dev/null +++ b/.gitignore
@@ -0,0 +1,16 @@ +# Gradle and builds +.gradle +**/build/ +**/out/ +!src/**/build +!gradle-wrapper.jar + +# Ignore Gradle GUI Config +gradle-app.setting + +# Project cache +.gradletasknamecache + +# Intellij +.idea +*.iml
diff --git a/build.gradle b/build.gradle new file mode 100644 index 0000000..5d69eca --- /dev/null +++ b/build.gradle
@@ -0,0 +1,186 @@ +plugins { + id 'java' + id 'checkstyle' + id "com.github.jk1.dependency-license-report" version "1.14" + id 'com.github.sherter.google-java-format' version '0.9' + id "com.github.spotbugs" version "4.4.2" + id "com.jfrog.artifactory" version "4.15.2" + id "net.ltgt.apt" version "0.21" + id "net.ltgt.errorprone" version "1.2.1" +} + +/* + * When you check a version of the library, place the date that you checked it next to the library. + * TODOs indicate who has context for the upgrade and any reasons it may be delayed, not necessarily + * who should perform it. +**/ +ext.libVersions = [ + // Core Libraries + "guava": "29.0-jre", // 22 June 2020 + "guice": "4.2.3", // 22 June 2020 + + // Logging + "flogger": "0.5.1", // 22 June 2020 + "logback": "1.2.3", // 16 January 2020 + "slf4j": "1.7.30", // 16 January 2020 + + // Client Libraries + "httpClient": "4.5.12", // 22 June 2020 + + // Build Utilities + "errorprone":"2.4.0", // 22 June 2020 + "errorproneJavacVersion":"9+181-r4173-1", // 22 June 2020 + "jacoco": "0.8.5", // 22 June 2020 + "spotbugs": "4.0.4", // 22 June 2020 + + // Test + "junit": "4.13", // 22 June 2020 + "mockito": "3.3.3", // 22 June 2020 + + // Command Line Utility Libraries + "jcommander": "1.78", // 22 June 2020 + + // OpenAPI Libraries + "openapiParser": "1.0.1", // 23 June 2020 + "openapiCore": "1.0.1" // 23 June 2020 +] + +allprojects { + apply plugin: 'checkstyle' + apply plugin: 'idea' + apply plugin: 'jacoco' + apply plugin: 'java' + + apply plugin: "com.github.jk1.dependency-license-report" + apply plugin: 'com.github.sherter.google-java-format' + apply plugin: "com.github.spotbugs" + apply plugin: 'net.ltgt.apt-idea' + apply plugin: "net.ltgt.errorprone" + + sourceCompatibility = 11 + targetCompatibility = 11 + + googleJavaFormat { + toolVersion = '1.7' + } + + repositories { + mavenCentral() + jcenter() + } + + dependencies { + checkstyle 'com.puppycrawl.tools:checkstyle:8.24' + errorproneJavac("com.google.errorprone:javac:${libVersions.errorproneJavacVersion}") + errorprone "com.google.errorprone:error_prone_core:${libVersions.errorprone}" + + implementation "com.google.flogger:flogger:${libVersions.flogger}" + implementation "com.google.guava:guava:${libVersions.guava}" + implementation "com.google.inject:guice:${libVersions.guice}" + + //testCompile project(':oas-test') + + //testImplementation "junit:junit:${libVersions.junit}" + //testImplementation "org.mockito:mockito-core:${libVersions.mockito}" + } + + checkstyle { + configFile = file("$rootDir/config/checkstyle/checkstyle.xml") + } + + checkstyleMain { + logging.setLevel(LogLevel.LIFECYCLE) + } + + checkstyleTest { + logging.setLevel(LogLevel.LIFECYCLE) + } + + group 'com.apigee.security.oas' + version '1.0-SNAPSHOT' + + + spotbugs { + toolVersion = libVersions.spotbugs + // TODO(ttourani): Create spotbugs-exclude.xml + //excludeFilter = file("$rootDir/spotbugs-exclude.xml") + effort = "max" + reportLevel = "low" + } + + tasks.withType(JavaCompile).configureEach { + options.errorprone { + disableWarningsInGeneratedCode = true + allDisabledChecksAsWarnings = true + error("Var") + disable("AndroidJdkLibsChecker") + disable("StaticOrDefaultInterfaceMethod") + disable("Java7ApiChecker") + excludedPaths = ".*/build/generated/.*" // Required due to https://github.com/google/error-prone/issues/1165 + } + } + + jacoco { + toolVersion = libVersions.jacoco + } + + jacocoTestReport { + reports { + xml.enabled true + csv.enabled false + html.enabled true + } + + } + + jacocoTestCoverageVerification { + violationRules { + rule { + limit { + minimum = 0.90 + } + + limit { + counter="BRANCH" + minimum = 0.90 + } + } + } + } + + gradle.projectsEvaluated { + tasks.withType(JavaCompile) { + options.compilerArgs << "-Werror" + } + } + + licenseReport { + configurations = ['runtimeClasspath'] + } + + jacocoTestCoverageVerification.dependsOn jacocoTestReport + + jacocoTestReport.mustRunAfter check + jacocoTestReport.mustRunAfter test + + build.dependsOn jacocoTestReport + + jacocoTestCoverageVerification.mustRunAfter build +} + +subprojects { + apply plugin: 'distribution' + apply plugin: 'net.ltgt.apt' + + idea { + module { + // Marks the already(!) added srcDir as "generated" + generatedSourceDirs += file('build/generated/sources/annotationProcessor/java') + } + } + + build.dependsOn check + build.dependsOn distTar +} + +defaultTasks 'build' \ No newline at end of file
diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml new file mode 100644 index 0000000..dc39908 --- /dev/null +++ b/config/checkstyle/checkstyle.xml
@@ -0,0 +1,253 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE module PUBLIC "-//Puppy Crawl//DTD Check Configuration 1.3//EN" "http://www.puppycrawl.com/dtds/configuration_1_3.dtd"> +<!-- This is a checkstyle configuration file. For descriptions of +what the following rules do, please see the checkstyle configuration +page at http://checkstyle.sourceforge.net/config.html --> +<!-- Checks with numbered comments refer to recommendations made +by Joshua Bloch in his book Effective Java --> +<module name="Checker"> + <property name="charset" value="UTF-8"/> + <module name="BeforeExecutionExclusionFileFilter"> + <property name="fileNamePattern" value="module\-info\.java$"/> + </module> + <module name="FileTabCharacter"> + <property name="eachLine" value="true"/> + <!-- Checks that there are no tab characters in the file. +--> + </module> + <module name="RegexpSingleline"> + <!-- Checks that FIXME is not used in comments. TODO is preferred. +--> + <property name="format" value="((//.*)|(\*.*))FIXME"/> + <property name="message" value="TODO is preferred to FIXME. e.g. "TODO(johndoe): Refactor when v2 is released.""/> + </module> + <module name="RegexpSingleline"> + <!-- Checks that TODOs have an owner or ticket and are formatted correctly: + http://go/java-style#s4.8.6.2-todo-comments +--> + <property name="format" value="TODO[^\(]."/> + <property name="message" value="TODOs need to have an owner or ticket specified (see go/tott-486)"/> + </module> + <module name="RegexpSingleline"> + <!-- Bans the use of System.out.println and associated methods. +--> + <property name="format" value="System\.[\a-z]+\.println"/> + <property name="message" value="Use a logger, not System's println."/> + </module> + <module name="RegexpSingleline"> + <!-- Bans the use of System#currentTimeMillis. +--> + <property name="format" value="System\.currentTimeMillis"/> + <property name="message" value="System.currentTimeMillis is strongly discouraged. There is almost no situation where it is the correct choice. See the java.time libraries instead."/> + </module> + <!-- Other libraries from: +https://engdoc.corp.google.com/eng/doc/devguide/java/practices/javatime.md +--> + <module name="RegexpSingleline"> + <property name="format" value="LocalDate\.now"/> + </module> + <module name="RegexpSingleline"> + <property name="format" value="LocalDateTime\.now"/> + </module> + <module name="RegexpSingleline"> + <property name="format" value="LocalTime\.now"/> + </module> + <module name="RegexpSingleline"> + <property name="format" value="OffsetDateTime\.now"/> + </module> + <module name="RegexpSingleline"> + <property name="format" value="ZonedDateTime\.now"/> + </module> + <module name="RegexpSingleline"> + <property name="format" value="Clock\.systemDefaultZone"/> + </module> + <!-- All Java AST specific tests live under TreeWalker module. --> + <module name="TreeWalker"> + <!-- +IMPORT CHECKS +--> + <module name="RedundantImport"> + <property name="severity" value="error"/> + </module> + <module name="AvoidStarImport"> + <property name="severity" value="error"/> + </module> + <module name="IllegalImport"> + <property name="severity" value="error"/> + <property name="illegalPkgs" value="com.sun, com.apache.beam.repackaged, jdk.internal, javax.annotation.concurrent, jdk.nashorn.internal, avro.shaded, jersey.repackaged"/> + <property name="illegalClasses" value="javax.annotation.Nullable, edu.umd.cs.findbugs.annotations.Nullable, com.google.inject.Inject, com.google.inject.BindingAnnotation, com.google.inject.Named, com.google.inject.Singleton, com.google.inject.ScopeAnnotation, java.util.Date, java.util.Calendar, jdk.nashorn.internal.ir.annotations.Immutable"/> + </module> + <!-- ENCODING AND FORMAT CHECKS --> + <module name="IllegalTokenText"> + <property name="tokens" value="STRING_LITERAL, CHAR_LITERAL"/> + <property name="format" value="\\u00(09|0(a|A)|0(c|C)|0(d|D)|22|27|5(C|c))|\\(0(10|11|12|14|15|42|47)|134)"/> + <property name="message" value="Consider using special escape sequence instead of octal value or Unicode escaped value."/> + </module> + <module name="AvoidEscapedUnicodeCharacters"> + <property name="allowEscapesForControlCharacters" value="true"/> + <property name="allowByTailComment" value="true"/> + <property name="allowNonPrintableEscapes" value="true"/> + </module> + <module name="EmptyLineSeparator"> + <!-- go/java-style#s4.6.1-vertical-whitespace --> + <property name="tokens" value="CLASS_DEF, METHOD_DEF, CTOR_DEF"/> + <property name="allowNoEmptyLineBetweenFields" value="true"/> + </module> + <!-- +JAVADOC CHECKS +--> + <!-- FORK: This policy was edited to use open-source implementation. --> + <!-- <module name="com.google.devtools.checkstyle.checks.javadoc.GoogleJavadocTypeCheck"> --> + <module name="JavadocType"> + <!-- Item 28 - Write doc comments for all exposed API elements. --> + <!-- Ensure all classes with visibility greater than or equal to + protected have class level documentation. --> + <property name="scope" value="protected"/> + <!-- Style guide doesn't prohibit custom tags. Typos will be caught by other tools. --> + <property name="allowUnknownTags" value="true"/> + <property name="allowMissingParamTags" value="true"/> + <message key="javadoc.missing" value="Missing a Javadoc comment."/> + </module> + <module name="JavadocMethod"> + <property name="scope" value="public"/> + <property name="allowMissingParamTags" value="true"/> + <property name="allowMissingThrowsTags" value="true"/> + <property name="allowMissingReturnTag" value="true"/> + <property name="allowUndeclaredRTE" value="true"/> + <property name="allowMissingPropertyJavadoc" value="true"/> + <property name="allowedAnnotations" value="Override, Test, Before, After, BeforeClass, AfterClass, "/> + <property name="allowThrowsTagsForSubclasses" value="true"/> + </module> + <module name="MissingJavadocMethod"> + <property name="severity" value="warning"/> + <property name="scope" value="public"/> + <property name="minLineCount" value="2"/> + <property name="allowedAnnotations" value="Override, Test, Provides"/> + </module> + <module name="NonEmptyAtclauseDescription"/> + <module name="SummaryJavadoc"> + <property name="severity" value="error"/> + <property name="forbiddenSummaryFragments" value="^@return the *|^This method returns |^A [{]@code [a-zA-Z0-9]+[}]( is a )"/> + </module> + <module name="InvalidJavadocPosition"/> + <module name="JavadocParagraph"/> + <module name="AtclauseOrder"> + <property name="tagOrder" value="@param, @return, @throws, @deprecated"/> + <property name="target" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF, VARIABLE_DEF"/> + </module> + <!-- +NAMING CHECKS +--> + <!-- Item 38 - Adhere to generally accepted naming conventions --> + <module name="PackageName"> + <!-- Validates identifiers for package names against the + supplied expression. --> + <property name="format" value="^([a-z][a-z0-9]*)(\.[a-z][a-z0-9]*)*$"/> + <property name="severity" value="error"/> + <message key="name.invalidPattern" value="Package name ''{0}'' must match pattern ''{1}''."/> + </module> + <module name="TypeNameCheck"> + <!-- Validates static, final fields against the supplied expression. --> + <metadata name="altname" value="TypeName"/> + <property name="format" value="^[A-Z][a-zA-Z0-9]*(_CustomFieldSerializer)?$"/> + </module> + <module name="MemberNameCheck"> + <!-- Validates non-static members against the supplied expression. --> + <metadata name="altname" value="MemberName"/> + <property name="applyToPublic" value="true"/> + <property name="applyToProtected" value="true"/> + <property name="applyToPackage" value="true"/> + <property name="applyToPrivate" value="true"/> + <!-- allows for googles deprecated foo_ member naming scheme --> + <property name="format" value="^[a-z][a-zA-Z0-9]*_?$"/> + </module> + <module name="MethodNameCheck"> + <!-- Validates identifiers for method names. --> + <metadata name="altname" value="MethodName"/> + <property name="format" value="^([a-z][a-zA-Z0-9]*(_[a-zA-Z0-9]+)*|__constructor__|__staticInitializer__)$"/> + <property name="severity" value="error"/> + </module> + <module name="ParameterName"> + <!-- Validates identifiers for method parameters against the + expression "^[a-z][a-zA-Z0-9]*$". --> + <property name="severity" value="error"/> + </module> + <module name="LambdaParameterName"> + <property name="severity" value="error"/> + <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/> + <message key="name.invalidPattern" value="Lambda parameter name ''{0}'' must match pattern ''{1}''."/> + </module> + <module name="CatchParameterName"> + <property name="severity" value="error"/> + <property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/> + <message key="name.invalidPattern" value="Catch parameter name ''{0}'' must match pattern ''{1}''."/> + </module> + <module name="LocalFinalVariableName"> + <!-- Validates identifiers for local final variables against the + expression "^[a-z][a-zA-Z0-9]*$". --> + <property name="severity" value="error"/> + </module> + <module name="LocalVariableName"> + <!-- Validates identifiers for local variables against the + expression "^[a-z][a-zA-Z0-9]*$". --> + <property name="severity" value="error"/> + </module> + <module name="ClassTypeParameterName"> + <!-- Class generic type. go/java-style/#s5.2.8-type-variable-names --> + <property name="severity" value="error"/> + <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/> + <message key="name.invalidPattern" value="Class type name ''{0}'' must match pattern ''{1}''."/> + </module> + <module name="MethodTypeParameterName"> + <!-- Method generic type. go/java-style/#s5.2.8-type-variable-names --> + <property name="severity" value="error"/> + <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/> + <message key="name.invalidPattern" value="Method type name ''{0}'' must match pattern ''{1}''."/> + </module> + <module name="InterfaceTypeParameterName"> + <!-- Interface generic type. go/java-style/#s5.2.8-type-variable-names --> + <property name="severity" value="error"/> + <property name="format" value="(^[A-Z][0-9]?)$|([A-Z][a-zA-Z0-9]*[T]$)"/> + <message key="name.invalidPattern" value="Interface type name ''{0}'' must match pattern ''{1}''."/> + </module> + <module name="AbbreviationAsWordInName"> + <property name="ignoreFinal" value="false"/> + <property name="allowedAbbreviationLength" value="1"/> + </module> + <module name="AnnotationLocation"> + <property name="id" value="AnnotationLocationMostCases"/> + <property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, METHOD_DEF, CTOR_DEF"/> + </module> + <module name="AnnotationLocation"> + <property name="id" value="AnnotationLocationVariables"/> + <property name="tokens" value="VARIABLE_DEF"/> + <property name="allowSamelineMultipleAnnotations" value="true"/> + </module> + <!-- +LENGTH and CODING CHECKS +--> + <module name="OperatorWrap"> + <property name="option" value="NL"/> + <property name="tokens" value="BAND, BOR, BSR, BXOR, DIV, EQUAL, GE, GT, LAND, LE, LITERAL_INSTANCEOF, LOR, LT, MINUS, MOD, NOT_EQUAL, PLUS, QUESTION, SL, SR, STAR, METHOD_REF "/> + </module> + <module name="OneTopLevelClass"/> + <!-- Checks for braces around if and else blocks --> + <module name="NeedBraces"> + <property name="severity" value="error"/> + <property name="tokens" value="LITERAL_IF, LITERAL_ELSE, LITERAL_FOR, LITERAL_WHILE, LITERAL_DO"/> + </module> + <!-- Ensures the use of style arrays and not C++-style arrays: +http://go/java-style#s4.8.3.2-array-declarations --> + <module name="ArrayTypeStyle"/> + <module name="EmptyCatchBlock"> + <property name="exceptionVariableName" value="expected"/> + </module> + <!-- Overloaded methods should always be grouped together. --> + <module name="OverloadMethodsDeclarationOrder"/> + <!-- http://go/java-style#s4.8.2.2-variables-limited-scope --> + <module name="VariableDeclarationUsageDistance"/> + <module name="EqualsAvoidNull"/> + <!-- http://go/java-style#s6.4-finalizers --> + <module name="NoFinalizer"/> + </module> +</module> \ No newline at end of file
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..87b738c --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.jar Binary files differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..9543e93 --- /dev/null +++ b/gradle/wrapper/gradle-wrapper.properties
@@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists \ No newline at end of file
diff --git a/gradlew b/gradlew new file mode 100755 index 0000000..af6708f --- /dev/null +++ b/gradlew
@@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "$0")" +fi + +exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat new file mode 100644 index 0000000..0f8d593 --- /dev/null +++ b/gradlew.bat
@@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega
diff --git a/oas-cli/build.gradle b/oas-cli/build.gradle new file mode 100644 index 0000000..f2a89ff --- /dev/null +++ b/oas-cli/build.gradle
@@ -0,0 +1,5 @@ +dependencies { + implementation 'com.beust:jcommander:1.78' + + testImplementation project(':oas-test') +} \ No newline at end of file
diff --git a/oas-cli/src/main/java/com/apigee/security/oas/CommandLineParser.java b/oas-cli/src/main/java/com/apigee/security/oas/CommandLineParser.java new file mode 100644 index 0000000..2b2bd6c --- /dev/null +++ b/oas-cli/src/main/java/com/apigee/security/oas/CommandLineParser.java
@@ -0,0 +1,3 @@ +package com.apigee.security.oas; + +public class CommandLineParser {}
diff --git a/oas-cli/src/test/java/com/apigee/security/oas/CommandLineParserTest.java b/oas-cli/src/test/java/com/apigee/security/oas/CommandLineParserTest.java new file mode 100644 index 0000000..7727d03 --- /dev/null +++ b/oas-cli/src/test/java/com/apigee/security/oas/CommandLineParserTest.java
@@ -0,0 +1,3 @@ +package com.apigee.security.oas; + +public class CommandLineParserTest {}
diff --git a/oas-core/build.gradle b/oas-core/build.gradle new file mode 100644 index 0000000..4556733 --- /dev/null +++ b/oas-core/build.gradle
@@ -0,0 +1,6 @@ +dependencies { + implementation "org.openapi4j:openapi-parser:${libVersions.openapiParser}" + implementation "org.openapi4j:openapi-core:${libVersions.openapiCore}" + + testImplementation project(":oas-test") +} \ No newline at end of file
diff --git a/oas-core/src/main/java/com/apigee/security/oas/parser/BaseParser.java b/oas-core/src/main/java/com/apigee/security/oas/parser/BaseParser.java new file mode 100644 index 0000000..9204695 --- /dev/null +++ b/oas-core/src/main/java/com/apigee/security/oas/parser/BaseParser.java
@@ -0,0 +1,3 @@ +package com.apigee.security.oas.parser; + +public class BaseParser {}
diff --git a/oas-core/src/test/java/com/apigee/security/oas/parser/BaseParserTest.java b/oas-core/src/test/java/com/apigee/security/oas/parser/BaseParserTest.java new file mode 100644 index 0000000..9f28094 --- /dev/null +++ b/oas-core/src/test/java/com/apigee/security/oas/parser/BaseParserTest.java
@@ -0,0 +1,3 @@ +package com.apigee.security.oas.parser; + +public class BaseParserTest {}
diff --git a/oas-test/build.gradle b/oas-test/build.gradle new file mode 100644 index 0000000..377662e --- /dev/null +++ b/oas-test/build.gradle
@@ -0,0 +1,4 @@ +dependencies { + implementation "junit:junit:${libVersions.junit}" + implementation "org.mockito:mockito-core:${libVersions.mockito}" +} \ No newline at end of file
diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 0000000..1da65f2 --- /dev/null +++ b/settings.gradle
@@ -0,0 +1,6 @@ +rootProject.name = 'api-security-tools' + +include 'oas-cli' +include 'oas-core' +include 'oas-test' +