1
0
mirror of https://github.com/square/okhttp.git synced 2025-08-08 23:42:08 +03:00

Basic Gradle support

This commit is contained in:
Jesse Wilson
2019-03-14 23:14:59 -04:00
parent 812dcc3bce
commit dc1e870d24
56 changed files with 696 additions and 1910 deletions

View File

@@ -21,6 +21,7 @@ elif [ "$TRAVIS_BRANCH" != "$BRANCH" ]; then
echo "Skipping snapshot deployment: wrong branch. Expected '$BRANCH' but was '$TRAVIS_BRANCH'."
else
echo "Deploying snapshot..."
./mvnw clean source:jar javadoc:jar deploy --settings=".buildscript/settings.xml" -DskipTests -B
echo "TODO: fix snapshot deployment for gradle..."
# ./mvnw clean source:jar javadoc:jar deploy --settings=".buildscript/settings.xml" -DskipTests -B
echo "Snapshot deployed!"
fi

View File

@@ -6,7 +6,7 @@ forking the repository and sending a pull request.
When submitting code, please make every effort to follow existing conventions
and style in order to keep the code as readable as possible. Please also make
sure your code compiles by running `mvn clean verify`. Checkstyle failures
sure your code compiles by running `./gradlew check`. Checkstyle failures
during compilation indicate errors in your style and can be viewed in the
`checkstyle-result.xml` file.

2
.gitignore vendored
View File

@@ -1,6 +1,7 @@
.classpath
.project
.settings
.gradle
eclipsebin
bin
@@ -8,6 +9,7 @@ gen
build
out
lib
generated
target
pom.xml.*

View File

@@ -5,16 +5,8 @@ jdk:
- openjdk8
- openjdk11
before_install:
- mvn -N io.takari:maven:wrapper -Dmaven=3.6.0
- echo "MAVEN_OPTS='-Dmaven.repo.local=$HOME/.m2/repository -Xmx1g -Dorg.slf4j.simpleLogger.showDateTime=true -Dorg.slf4j.simpleLogger.dateTimeFormat=HH:mm:ss:SSS'" > ~/.mavenrc
install:
- ./mvnw dependency:resolve -B || true
script:
- ./mvnw -DskipTests package checkstyle:check -B
- ./mvnw test javadoc:jar source:jar -B
- ./gradlew check
after_success:
- .buildscript/deploy_snapshot.sh

154
build.gradle Normal file
View File

@@ -0,0 +1,154 @@
buildscript {
ext.versions = [
'airline': '0.8',
'android': '4.1.1.4',
'animalSniffer': '1.17',
'assertj': '3.11.0',
'bouncycastle': '1.60',
'checkstyle': '8.15',
'conscrypt': '2.0.0',
'findbugs': '3.0.2',
'guava': '27.0.1-jre',
'java': '1.8',
'jnrUnixsocket': '0.22',
'jsoup': '1.11.3',
'junit': '4.12',
'moshi': '1.8.0',
'okio': '1.17.2',
]
ext.deps = [
'airline': "io.airlift:airline:${versions.airline}",
'android': "com.google.android:android:${versions.android}",
'animalSniffer': "org.codehaus.mojo:animal-sniffer-annotations:${versions.animalSniffer}",
'assertj': "org.assertj:assertj-core:${versions.assertj}",
'bouncycastle': "org.bouncycastle:bcprov-jdk15on:${versions.bouncycastle}",
'conscrypt': "org.conscrypt:conscrypt-openjdk-uber:${versions.conscrypt}",
'guava': "com.google.guava:guava:${versions.guava}",
'jnrUnixsocket': "com.github.jnr:jnr-unixsocket:${versions.jnrUnixsocket}",
'jsoup': "org.jsoup:jsoup:${versions.jsoup}",
'jsr305': "com.google.code.findbugs:jsr305:${versions.findbugs}",
'junit': "junit:junit:${versions.junit}",
'moshi': "com.squareup.moshi:moshi:${versions.moshi}",
'okio': "com.squareup.okio:okio:${versions.okio}"
]
dependencies {
// TODO(jwilson): configure maven-publish-plugin to limit which artifacts are published.
classpath 'com.vanniktech:gradle-maven-publish-plugin:0.8.0'
}
repositories {
mavenCentral()
gradlePluginPortal()
}
}
plugins {
id 'ru.vyarus.animalsniffer' version '1.5.0'
id 'com.github.johnrengelman.shadow' version '4.0.1'
}
allprojects {
group = GROUP
version = VERSION_NAME
repositories {
mavenCentral()
}
}
subprojects { project ->
apply plugin: 'java'
apply plugin: 'java-library'
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
apply plugin: 'checkstyle'
checkstyleMain.exclude '**/CipherSuite.java'
afterEvaluate {
checkstyle {
configFile = rootProject.file('checkstyle.xml')
toolVersion "${versions.checkstyle}"
sourceSets = [project.sourceSets.main]
}
}
// Animal Sniffer confirms we don't use APIs not on both Java 8 and Android 5.
apply plugin: 'ru.vyarus.animalsniffer'
animalsniffer {
sourceSets = [sourceSets.main]
}
dependencies {
signature 'net.sf.androidscents.signature:android-api-level-21:5.0.1_r2@signature'
signature 'org.codehaus.mojo.signature:java18:1.0@signature'
}
test {
jvmArgs += "-Dlistener=okhttp3.testing.InstallUncaughtExceptionHandlerListener"
jvmArgs += "-Dokhttp.platform=platform"
}
// Add alpn-boot on Java 8 so we can use HTTP/2 without a stable API.
def alpnBootVersion = alpnBootVersion()
if (alpnBootVersion != null) {
dependencies {
testCompile "org.mortbay.jetty.alpn:alpn-boot:$alpnBootVersion"
}
def alpnBootJar = configurations.testCompile.find { it.name.startsWith("alpn-boot-") }
test {
jvmArgs += "-Xbootclasspath/p:${alpnBootJar}"
}
}
// TODO(jwilson): configure error prone.
}
tasks.wrapper {
distributionType = Wrapper.DistributionType.ALL
}
/**
* Returns the alpn-boot version specific to this OpenJDK 8 JVM, or null if this is not a Java 8 VM.
* https://github.com/xjdr/xio/blob/master/alpn-boot.gradle
*/
def alpnBootVersion() {
def javaVersion = System.getProperty("java.version")
def patchVersionMatcher = (javaVersion =~ /1\.8\.0_(\d+)(-.*)?/)
if (!patchVersionMatcher.find()) return null
def patchVersion = Integer.parseInt(patchVersionMatcher.group(1))
return alpnBootVersionForPatchVersion(javaVersion, patchVersion)
}
def alpnBootVersionForPatchVersion(String javaVersion, int patchVersion) {
switch (patchVersion) {
case 0..24:
return '8.1.0.v20141016'
case 25..30:
return '8.1.2.v20141202'
case 31..50:
return '8.1.3.v20150130'
case 51..59:
return '8.1.4.v20150727'
case 60..64:
return '8.1.5.v20150921'
case 65..70:
return '8.1.6.v20151105'
case 71..77:
return '8.1.7.v20160121'
case 78..101:
return '8.1.8.v20160420'
case 102..111:
return '8.1.9.v20160720'
case 112..120:
return '8.1.10.v20161026'
case 121..160:
return '8.1.11.v20170118'
case 161..181:
return '8.1.12.v20180117'
case 191..202:
return '8.1.13.v20181017'
default:
throw new IllegalStateException("Unexpected Java version: ${javaVersion}")
}
}

View File

@@ -28,8 +28,6 @@
</module>
<module name="TreeWalker">
<property name="cacheFile" value="${checkstyle.cache.file}"/>
<!-- Checks for Javadoc comments. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
<!--module name="JavadocMethod"/-->

16
gradle.properties Normal file
View File

@@ -0,0 +1,16 @@
org.gradle.jvmargs='-Dfile.encoding=UTF-8'
GROUP=com.squareup.okhttp3
VERSION_NAME=3.15.0-SNAPSHOT
POM_URL=https://github.com/square/okhttp
POM_SCM_URL=https://github.com/square/okhttp
POM_SCM_CONNECTION=scm:git:https://github.com/square/okhttp.git
POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/square/okhttp.git
POM_LICENCE_NAME=The Apache Software License, Version 2.0
POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_LICENCE_DIST=repo
POM_DEVELOPER_ID=square
POM_DEVELOPER_NAME=Square, Inc.

BIN
gradle/wrapper/gradle-wrapper.jar vendored Normal file

Binary file not shown.

View File

@@ -0,0 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

172
gradlew vendored Executable file
View File

@@ -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" "$@"

84
gradlew.bat vendored Normal file
View File

@@ -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

View File

@@ -0,0 +1,14 @@
jar {
manifest {
attributes('Automatic-Module-Name': 'okhttp3.mockwebserver')
}
}
dependencies {
api project(':okhttp')
api deps.junit
testImplementation project(':okhttp-testing-support')
testImplementation project(':okhttp-tls')
testImplementation deps.assertj
}

View File

@@ -1,89 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>parent</artifactId>
<version>3.15.0-SNAPSHOT</version>
</parent>
<artifactId>mockwebserver</artifactId>
<name>MockWebServer</name>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>okhttp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>okhttp-testing-support</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>okhttp-tls</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<links>
<link>http://square.github.io/okhttp/javadoc/</link>
<link>http://square.github.io/okio/</link>
</links>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>okhttp3.mockwebserver</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

36
okcurl/build.gradle Normal file
View File

@@ -0,0 +1,36 @@
jar {
manifest {
attributes 'Automatic-Module-Name': 'okhttp3.curl'
attributes 'Main-Class': 'okhttp3.curl.Main'
}
}
// resources-templates.
sourceSets {
main.resources.srcDirs += "$buildDir/generated/resources-templates"
}
compileJava {
dependsOn 'copyResourcesTemplates'
}
task copyResourcesTemplates(type: Copy) {
from 'src/main/resources-templates'
into "$buildDir/generated/resources-templates"
expand('projectVersion': "$VERSION_NAME")
filteringCharset = 'UTF-8'
}
dependencies {
api project(':okhttp')
api project(':okhttp-logging-interceptor')
implementation deps.airline
implementation deps.guava
testImplementation project(':okhttp-testing-support')
testImplementation deps.junit
testImplementation deps.assertj
}
apply plugin: 'com.github.johnrengelman.shadow'
shadowJar {
mergeServiceFiles()
}

View File

@@ -1,115 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>parent</artifactId>
<version>3.15.0-SNAPSHOT</version>
</parent>
<artifactId>okcurl</artifactId>
<name>OkCurl</name>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>okhttp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>logging-interceptor</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>okhttp-testing-support</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.airlift</groupId>
<artifactId>airline</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>okhttp3.curl.Main</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.skife.maven</groupId>
<artifactId>really-executable-jar-maven-plugin</artifactId>
<version>1.5.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>really-executable-jar</goal>
</goals>
</execution>
</executions>
<configuration>
<flags>-Xbootclasspath/p:$0</flags>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>okhttp3.curl</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1 @@
version=${projectVersion}

View File

@@ -1 +0,0 @@
version=${project.version}

View File

@@ -85,6 +85,11 @@ public class MainTest {
assertThat(request.body()).isNull();
}
@Test public void defaultUserAgent() {
Request request = fromArgs("http://example.com").createRequest();
assertThat(request.header("User-Agent")).startsWith("okcurl/");
}
@Test public void headerSplitWithDate() {
Request request = fromArgs("-H", "If-Modified-Since: Mon, 18 Aug 2014 15:16:06 GMT",
"http://example.com").createRequest();

View File

@@ -0,0 +1,16 @@
jar {
manifest {
attributes('Automatic-Module-Name': 'okhttp3.dnsoverhttps')
}
}
dependencies {
api project(':okhttp')
compileOnly deps.jsr305
testImplementation project(':okhttp-testing-support')
testImplementation project(':mockwebserver')
testImplementation deps.conscrypt
testImplementation deps.junit
testImplementation deps.assertj
}

View File

@@ -1,72 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>parent</artifactId>
<version>3.15.0-SNAPSHOT</version>
</parent>
<artifactId>okhttp-dnsoverhttps</artifactId>
<name>OkHttp DNS over HTTPS</name>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>okhttp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>okhttp-testing-support</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mockwebserver</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.conscrypt</groupId>
<artifactId>conscrypt-openjdk-uber</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>okhttp3.dnsoverhttps</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,9 @@
dependencies {
testImplementation deps.okio
testImplementation deps.moshi
testImplementation project(':okhttp')
testImplementation project(':okhttp-testing-support')
testImplementation project(':mockwebserver')
testImplementation deps.junit
testImplementation deps.assertj
}

View File

@@ -1,65 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>parent</artifactId>
<version>3.15.0-SNAPSHOT</version>
</parent>
<artifactId>okhttp-hpacktests</artifactId>
<name>OkHttp HPACK Tests</name>
<dependencies>
<dependency>
<groupId>com.squareup.okio</groupId>
<artifactId>okio</artifactId>
</dependency>
<dependency>
<groupId>com.squareup.moshi</groupId>
<artifactId>moshi</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>okhttp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>okhttp-testing-support</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mockwebserver</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Do not deploy this as an artifact to Maven central. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,17 @@
jar {
manifest {
attributes('Automatic-Module-Name': 'okhttp3.logging')
}
}
dependencies {
api project(':okhttp')
compileOnly deps.jsr305
testCompileOnly deps.jsr305
testImplementation deps.junit
testImplementation project(':mockwebserver')
testImplementation project(':okhttp-testing-support')
testImplementation project(':okhttp-tls')
testImplementation deps.assertj
}

View File

@@ -1,73 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>parent</artifactId>
<version>3.15.0-SNAPSHOT</version>
</parent>
<artifactId>logging-interceptor</artifactId>
<name>OkHttp Logging Interceptor</name>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>okhttp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mockwebserver</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>okhttp-testing-support</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>okhttp-tls</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>okhttp3.logging</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

16
okhttp-sse/build.gradle Normal file
View File

@@ -0,0 +1,16 @@
jar {
manifest {
attributes('Automatic-Module-Name': 'okhttp3.sse')
}
}
dependencies {
api project(':okhttp')
compileOnly deps.jsr305
testImplementation project(':okhttp-testing-support')
testImplementation project(':mockwebserver')
testImplementation deps.junit
testImplementation deps.assertj
testCompileOnly deps.jsr305
}

View File

@@ -1,78 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>parent</artifactId>
<version>3.15.0-SNAPSHOT</version>
</parent>
<artifactId>okhttp-sse</artifactId>
<name>OkHttp Server-Sent Events</name>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>okhttp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>okhttp-testing-support</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mockwebserver</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<excludePackageNames>okhttp3.internal:okhttp3.internal.*</excludePackageNames>
<links>
<link>http://square.github.io/okhttp/javadoc/</link>
</links>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>okhttp3.sse</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,6 @@
dependencies {
api project(':okhttp')
api deps.junit
api deps.assertj
compileOnly deps.jsr305
}

View File

@@ -1,53 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>parent</artifactId>
<version>3.15.0-SNAPSHOT</version>
</parent>
<artifactId>okhttp-testing-support</artifactId>
<name>OkHttp test support classes</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>okhttp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>okhttp3.testing</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

13
okhttp-tests/build.gradle Normal file
View File

@@ -0,0 +1,13 @@
dependencies {
testImplementation deps.okio
testImplementation project(':okhttp')
testImplementation project(':okhttp-testing-support')
testImplementation project(':okhttp-tls')
testImplementation project(':okhttp-urlconnection')
testImplementation project(':mockwebserver')
testImplementation project(':okhttp-logging-interceptor')
testImplementation deps.conscrypt
testImplementation deps.junit
testImplementation deps.assertj
testCompileOnly deps.jsr305
}

View File

@@ -1,112 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>parent</artifactId>
<version>3.15.0-SNAPSHOT</version>
</parent>
<artifactId>okhttp-tests</artifactId>
<name>OkHttp Tests</name>
<dependencies>
<dependency>
<groupId>com.squareup.okio</groupId>
<artifactId>okio</artifactId>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>okhttp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>okhttp-testing-support</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>okhttp-tls</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>okhttp-urlconnection</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.conscrypt</groupId>
<artifactId>conscrypt-openjdk-uber</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mockwebserver</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>logging-interceptor</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.1.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>okhttp3.AutobahnTester</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- Do not deploy this as an artifact to Maven central. -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -180,6 +180,9 @@ public final class CertificatePinnerChainValidationTest {
}
@Test public void unrelatedPinnedLeafCertificateInChain() throws Exception {
// https://github.com/square/okhttp/issues/4729
assumeFalse(getJvmSpecVersion().equals("11"));
// Start with a trusted root CA certificate.
HeldCertificate rootCa = new HeldCertificate.Builder()
.serialNumber(1L)
@@ -255,6 +258,9 @@ public final class CertificatePinnerChainValidationTest {
}
@Test public void unrelatedPinnedIntermediateCertificateInChain() throws Exception {
// https://github.com/square/okhttp/issues/4729
assumeFalse(getJvmSpecVersion().equals("11"));
// Start with two root CA certificates, one is good and the other is compromised.
HeldCertificate rootCa = new HeldCertificate.Builder()
.serialNumber(1L)

16
okhttp-tls/build.gradle Normal file
View File

@@ -0,0 +1,16 @@
jar {
manifest {
attributes('Automatic-Module-Name': 'okhttp3.tls')
}
}
dependencies {
api deps.okio
implementation project(':okhttp')
implementation deps.bouncycastle
compileOnly deps.jsr305
testImplementation project(':okhttp-testing-support')
testImplementation deps.junit
testImplementation deps.assertj
}

View File

@@ -1,76 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>parent</artifactId>
<version>3.15.0-SNAPSHOT</version>
</parent>
<artifactId>okhttp-tls</artifactId>
<name>OkHttp Transport Layer Security (TLS)</name>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>okhttp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>okhttp-testing-support</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<excludePackageNames>okhttp3.tls.internal:okhttp3.tls.internal.*</excludePackageNames>
<links>
<link>http://square.github.io/okhttp/javadoc/</link>
</links>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>okhttp3.tls</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,17 @@
jar {
manifest {
attributes('Automatic-Module-Name': 'okhttp3.urlconnection')
}
}
dependencies {
api project(':okhttp')
compileOnly deps.jsr305
compileOnly deps.animalSniffer
testImplementation project(':okhttp-testing-support')
testImplementation project(':okhttp-tls')
testImplementation project(':mockwebserver')
testImplementation deps.junit
testImplementation deps.assertj
}

View File

@@ -1,90 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>parent</artifactId>
<version>3.15.0-SNAPSHOT</version>
</parent>
<artifactId>okhttp-urlconnection</artifactId>
<name>OkHttp URLConnection</name>
<dependencies>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-annotations</artifactId>
<version>${animal.sniffer.version}</version>
<optional>true</optional>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>okhttp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>okhttp-testing-support</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>okhttp-tls</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>mockwebserver</artifactId>
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<excludePackageNames>okhttp3.internal:okhttp3.internal.*</excludePackageNames>
<links>
<link>http://square.github.io/okhttp/javadoc/</link>
</links>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>okhttp3.urlconnection</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

31
okhttp/build.gradle Normal file
View File

@@ -0,0 +1,31 @@
jar {
manifest {
attributes('Automatic-Module-Name': 'okhttp3')
}
}
sourceSets {
main.java.srcDirs += "$buildDir/generated/sources/java-templates/java/main"
}
compileJava {
dependsOn 'copyJavaTemplates'
}
task copyJavaTemplates(type: Copy) {
from 'src/main/java-templates'
into "$buildDir/generated/sources/java-templates/java/main"
expand('projectVersion': "$VERSION_NAME")
filteringCharset = 'UTF-8'
}
dependencies {
api deps.okio
compileOnly deps.conscrypt
compileOnly deps.android
compileOnly deps.jsr305
compileOnly deps.animalSniffer
testImplementation deps.junit
testImplementation deps.assertj
}

View File

@@ -1,82 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>parent</artifactId>
<version>3.15.0-SNAPSHOT</version>
</parent>
<artifactId>okhttp</artifactId>
<name>OkHttp</name>
<dependencies>
<dependency>
<groupId>com.squareup.okio</groupId>
<artifactId>okio</artifactId>
</dependency>
<dependency>
<groupId>org.conscrypt</groupId>
<artifactId>conscrypt-openjdk-uber</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-annotations</artifactId>
<version>1.17</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>templating-maven-plugin</artifactId>
<version>1.0.0</version>
<executions>
<execution>
<goals>
<goal>filter-sources</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<excludePackageNames>okhttp3.internal:okhttp3.internal.*</excludePackageNames>
<links>
<link>http://square.github.io/okio/</link>
</links>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.1</version>
<configuration>
<archive>
<manifestEntries>
<Automatic-Module-Name>okhttp3</Automatic-Module-Name>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -17,7 +17,7 @@ package okhttp3.internal;
public final class Version {
public static String userAgent() {
return "okhttp/${project.version}";
return "okhttp/${projectVersion}";
}
private Version() {

740
pom.xml
View File

@@ -1,740 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>parent</artifactId>
<version>3.15.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>OkHttp (Parent)</name>
<description>An HTTP+HTTP/2 client for Android and Java applications</description>
<url>https://github.com/square/okhttp</url>
<modules>
<module>okhttp</module>
<module>okhttp-tests</module>
<module>okhttp-sse</module>
<module>okhttp-testing-support</module>
<module>okhttp-tls</module>
<module>okhttp-urlconnection</module>
<module>okhttp-logging-interceptor</module>
<module>okhttp-dnsoverhttps</module>
<module>okcurl</module>
<module>mockwebserver</module>
<module>samples</module>
</modules>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Compilation -->
<airlift.version>0.8</airlift.version>
<android.version>4.1.1.4</android.version>
<animal.sniffer.version>1.17</animal.sniffer.version>
<bouncycastle.version>1.60</bouncycastle.version>
<guava.version>27.0.1-jre</guava.version>
<java.version>1.8</java.version>
<moshi.version>1.8.0</moshi.version>
<jnr-unixsocket.version>0.22</jnr-unixsocket.version>
<okio.version>1.17.2</okio.version>
<conscrypt.version>2.0.0</conscrypt.version>
<!-- Test Dependencies -->
<junit.version>4.12</junit.version>
<assertj.version>3.11.0</assertj.version>
<!-- platform test mode -->
<okhttp.platform>platform</okhttp.platform>
</properties>
<scm>
<url>https://github.com/square/okhttp/</url>
<connection>scm:git:https://github.com/square/okhttp.git</connection>
<developerConnection>scm:git:git@github.com:square/okhttp.git</developerConnection>
<tag>HEAD</tag>
</scm>
<issueManagement>
<system>GitHub Issues</system>
<url>https://github.com/square/okhttp/issues</url>
</issueManagement>
<licenses>
<license>
<name>Apache 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
</license>
</licenses>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.squareup.okio</groupId>
<artifactId>okio</artifactId>
<version>${okio.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>3.0.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>${bouncycastle.version}</version>
</dependency>
<dependency>
<groupId>io.airlift</groupId>
<artifactId>airline</artifactId>
<version>${airlift.version}</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>${android.version}</version>
</dependency>
<dependency>
<groupId>com.squareup.moshi</groupId>
<artifactId>moshi</artifactId>
<version>${moshi.version}</version>
</dependency>
<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jnr-unixsocket</artifactId>
<version>${jnr-unixsocket.version}</version>
</dependency>
<dependency>
<groupId>org.conscrypt</groupId>
<artifactId>conscrypt-openjdk-uber</artifactId>
<version>${conscrypt.version}</version>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>${assertj.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<systemPropertyVariables>
<okhttp.platform>${okhttp.platform}</okhttp.platform>
</systemPropertyVariables>
<redirectTestOutputToFile>true</redirectTestOutputToFile>
<properties>
<!--
Configure a listener for enforcing that no uncaught exceptions issue from OkHttp
tests. Every test must have a <scope>test</scope> dependency on
okhttp-testing-support.
-->
<property>
<name>listener</name>
<value>okhttp3.testing.InstallUncaughtExceptionHandlerListener</value>
</property>
</properties>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.22.1</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.1</version>
<configuration>
<failOnError>false</failOnError>
<doclint>none</doclint>
</configuration>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.0.0</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.18</version>
</dependency>
</dependencies>
<configuration>
<failsOnError>true</failsOnError>
<configLocation>checkstyle.xml</configLocation>
<consoleOutput>true</consoleOutput>
<excludes>**/CipherSuite.java</excludes>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>checkstyle</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<version>${animal.sniffer.version}</version>
<executions>
<execution>
<id>sniff-java18</id>
<phase>test</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<signature>
<groupId>org.codehaus.mojo.signature</groupId>
<artifactId>java18</artifactId>
<version>1.0</version>
</signature>
</configuration>
</execution>
<execution>
<id>sniff-android5</id>
<phase>test</phase>
<goals>
<goal>check</goal>
</goals>
<configuration>
<signature>
<groupId>net.sf.androidscents.signature</groupId>
<artifactId>android-api-level-21</artifactId>
<version>5.0.1_r2</version>
</signature>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>errorprone</id>
<activation>
<jdk>1.8</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<compilerId>javac-with-errorprone</compilerId>
<forceJavacCompilerUse>true</forceJavacCompilerUse>
<source>${java.version}</source>
<target>${java.version}</target>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-compiler-javac-errorprone</artifactId>
<version>2.8.5</version>
</dependency>
<dependency>
<groupId>com.google.errorprone</groupId>
<artifactId>error_prone_core</artifactId>
<version>2.3.2</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>javadoc-lenient</id>
<!-- MJAVADOC-555 Fixed in upcoming JDK builds -->
<activation>
<jdk>11</jdk>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>alpn-when-jdk8</id>
<activation>
<jdk>1.8</jdk>
</activation>
<properties>
<bootclasspathPrefix>
${settings.localRepository}/org/mortbay/jetty/alpn/alpn-boot/${alpn.jdk8.version}/alpn-boot-${alpn.jdk8.version}.jar
</bootclasspathPrefix>
<okhttp.platform>jdk-with-jetty-boot</okhttp.platform>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<argLine>-Xbootclasspath/p:${bootclasspathPrefix} -Xms512m -Xmx512m</argLine>
</configuration>
<dependencies>
<dependency>
<groupId>org.mortbay.jetty.alpn</groupId>
<artifactId>alpn-boot</artifactId>
<version>${alpn.jdk8.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
<profile>
<id>jdk9</id>
<activation>
<jdk>9</jdk>
</activation>
<properties>
<okhttp.platform>jdk9</okhttp.platform>
</properties>
</profile>
<profile>
<id>jdk10</id>
<activation>
<jdk>10</jdk>
</activation>
<properties>
<okhttp.platform>jdk9</okhttp.platform>
</properties>
</profile>
<profile>
<id>jdk11</id>
<activation>
<jdk>11</jdk>
</activation>
<properties>
<okhttp.platform>jdk9</okhttp.platform>
</properties>
</profile>
<profile>
<id>jdk12</id>
<activation>
<jdk>12</jdk>
</activation>
<properties>
<okhttp.platform>jdk9</okhttp.platform>
</properties>
</profile>
<profile>
<id>conscrypt</id>
<properties>
<okhttp.platform>conscrypt</okhttp.platform>
</properties>
<dependencies>
<dependency>
<groupId>org.conscrypt</groupId>
<artifactId>conscrypt-openjdk-uber</artifactId>
</dependency>
</dependencies>
</profile>
<!-- ALPN Versions targeted for each Java 8 minor release -->
<!-- Check versions with this page: -->
<!-- http://www.eclipse.org/jetty/documentation/current/alpn-chapter.html#alpn-chapterchapterversions -->
<profile>
<id>alpn-when-jdk8_05</id>
<activation>
<jdk>1.8.0_05</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.0.v20141016</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_11</id>
<activation>
<jdk>1.8.0_11</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.0.v20141016</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_20</id>
<activation>
<jdk>1.8.0_20</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.0.v20141016</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_25</id>
<activation>
<jdk>1.8.0_25</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.2.v20141202</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_31</id>
<activation>
<jdk>1.8.0_31</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.3.v20150130</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_40</id>
<activation>
<jdk>1.8.0_40</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.3.v20150130</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_45</id>
<activation>
<jdk>1.8.0_45</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.3.v20150130</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_51</id>
<activation>
<jdk>1.8.0_51</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.4.v20150727</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_60</id>
<activation>
<jdk>1.8.0_60</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.5.v20150921</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_65</id>
<activation>
<jdk>1.8.0_65</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.6.v20151105</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_66</id>
<activation>
<jdk>1.8.0_66</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.6.v20151105</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_71</id>
<activation>
<jdk>1.8.0_71</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.7.v20160121</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_72</id>
<activation>
<jdk>1.8.0_72</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.7.v20160121</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_73</id>
<activation>
<jdk>1.8.0_73</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.7.v20160121</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_74</id>
<activation>
<jdk>1.8.0_74</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.7.v20160121</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_77</id>
<activation>
<jdk>1.8.0_77</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.7.v20160121</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_91</id>
<activation>
<jdk>1.8.0_91</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.7.v20160121</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_92</id>
<activation>
<jdk>1.8.0_92</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.8.v20160420</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_101</id>
<activation>
<jdk>1.8.0_101</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.8.v20160420</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_102</id>
<activation>
<jdk>1.8.0_102</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.9.v20160720</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_111</id>
<activation>
<jdk>1.8.0_111</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.9.v20160720</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_112</id>
<activation>
<jdk>1.8.0_112</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.9.v20160720</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_121</id>
<activation>
<jdk>1.8.0_121</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.11.v20170118</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_131</id>
<activation>
<jdk>1.8.0_131</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.11.v20170118</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_141</id>
<activation>
<jdk>1.8.0_141</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.11.v20170118</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_144</id>
<activation>
<jdk>1.8.0_144</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.11.v20170118</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_151</id>
<activation>
<jdk>1.8.0_151</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.11.v20170118</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_152</id>
<activation>
<jdk>1.8.0_152</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.11.v20170118</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_161</id>
<activation>
<jdk>1.8.0_161</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.12.v20180117</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_162</id>
<activation>
<jdk>1.8.0_162</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.12.v20180117</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_171</id>
<activation>
<jdk>1.8.0_171</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.12.v20180117</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_172</id>
<activation>
<jdk>1.8.0_172</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.12.v20180117</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_181</id>
<activation>
<jdk>1.8.0_181</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.12.v20180117</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_191</id>
<activation>
<jdk>1.8.0_191</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.13.v20181017</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_192</id>
<activation>
<jdk>1.8.0_192</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.13.v20181017</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_201</id>
<activation>
<jdk>1.8.0_201</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.13.v20181017</alpn.jdk8.version>
</properties>
</profile>
<profile>
<id>alpn-when-jdk8_202</id>
<activation>
<jdk>1.8.0_202</jdk>
</activation>
<properties>
<alpn.jdk8.version>8.1.13.v20181017</alpn.jdk8.version>
</properties>
</profile>
</profiles>
</project>

View File

@@ -0,0 +1,4 @@
dependencies {
implementation project(':okhttp')
implementation deps.jsoup
}

View File

@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.squareup.okhttp3.sample</groupId>
<artifactId>sample-parent</artifactId>
<version>3.15.0-SNAPSHOT</version>
</parent>
<artifactId>crawler</artifactId>
<name>Sample: Crawler</name>
<dependencies>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.11.3</version>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,6 @@
dependencies {
implementation project(':okhttp')
implementation project(':mockwebserver')
implementation project(':okhttp-tls')
implementation deps.moshi
}

View File

@@ -1,36 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.squareup.okhttp3.sample</groupId>
<artifactId>sample-parent</artifactId>
<version>3.15.0-SNAPSHOT</version>
</parent>
<artifactId>guide</artifactId>
<name>Sample: Guide</name>
<dependencies>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>mockwebserver</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp-tls</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.squareup.moshi</groupId>
<artifactId>moshi</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -1,40 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>parent</artifactId>
<version>3.15.0-SNAPSHOT</version>
</parent>
<groupId>com.squareup.okhttp3.sample</groupId>
<artifactId>sample-parent</artifactId>
<packaging>pom</packaging>
<name>Samples (Parent)</name>
<modules>
<module>guide</module>
<module>crawler</module>
<module>simple-client</module>
<module>slack</module>
<module>static-server</module>
<module>unixdomainsockets</module>
</modules>
<build>
<plugins>
<plugin>
<!-- Fails on Throwable.addSuppressed() in ARM blocks. -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>animal-sniffer-maven-plugin</artifactId>
<executions>
<execution>
<phase>none</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,4 @@
dependencies {
implementation project(':okhttp')
implementation deps.moshi
}

View File

@@ -1,27 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.squareup.okhttp3.sample</groupId>
<artifactId>sample-parent</artifactId>
<version>3.15.0-SNAPSHOT</version>
</parent>
<artifactId>simple-client</artifactId>
<name>Sample: Simple Client</name>
<dependencies>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.squareup.moshi</groupId>
<artifactId>moshi</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,4 @@
dependencies {
implementation project(':mockwebserver')
implementation deps.moshi
}

View File

@@ -1,26 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.squareup.okhttp3.sample</groupId>
<artifactId>sample-parent</artifactId>
<version>3.15.0-SNAPSHOT</version>
</parent>
<artifactId>slack</artifactId>
<name>Sample: Slack</name>
<dependencies>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>mockwebserver</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.squareup.moshi</groupId>
<artifactId>moshi</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,14 @@
jar {
manifest {
attributes 'Main-Class': 'okhttp3.sample.SampleServer'
}
}
dependencies {
implementation project(':mockwebserver')
}
apply plugin: 'com.github.johnrengelman.shadow'
shadowJar {
mergeServiceFiles()
}

View File

@@ -1,62 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.squareup.okhttp3.sample</groupId>
<artifactId>sample-parent</artifactId>
<version>3.15.0-SNAPSHOT</version>
</parent>
<artifactId>static-server</artifactId>
<name>Sample: Static Server</name>
<dependencies>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>mockwebserver</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.1</version>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>shaded</shadedClassifierName>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<manifestEntries>
<Main-Class>okhttp3.sample.SampleServer</Main-Class>
</manifestEntries>
</transformer>
</transformers>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,5 @@
dependencies {
implementation project(':okhttp')
implementation project(':mockwebserver')
implementation deps.jnrUnixsocket
}

View File

@@ -1,31 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>com.squareup.okhttp3.sample</groupId>
<artifactId>sample-parent</artifactId>
<version>3.15.0-SNAPSHOT</version>
</parent>
<artifactId>unixdomainsockets</artifactId>
<name>Sample: UNIX domain sockets</name>
<dependencies>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>mockwebserver</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jnr-unixsocket</artifactId>
</dependency>
</dependencies>
</project>

17
settings.gradle Normal file
View File

@@ -0,0 +1,17 @@
include ':mockwebserver'
include ':okcurl'
include ':okhttp'
include ':okhttp-dnsoverhttps'
include ':okhttp-hpacktests'
include ':okhttp-logging-interceptor'
include ':okhttp-sse'
include ':okhttp-testing-support'
include ':okhttp-tests'
include ':okhttp-tls'
include ':okhttp-urlconnection'
include ':samples:crawler'
include ':samples:guide'
include ':samples:simple-client'
include ':samples:slack'
include ':samples:static-server'
include ':samples:unixdomainsockets'

View File

@@ -124,7 +124,7 @@ String post(String url, String json) throws IOException {
<h3 id="contributing">Contributing</h3>
<p>If you would like to contribute code you can do so through GitHub by forking the repository and sending a pull request.</p>
<p>When submitting code, please make every effort to follow existing conventions and style in order to keep the code as readable as possible. Please also make sure your code compiles by running <code>mvn clean verify</code>.</p>
<p>When submitting code, please make every effort to follow existing conventions and style in order to keep the code as readable as possible. Please also make sure your code compiles by running <code>./gradlew check</code>.</p>
<p>Some general advice</p>
<ul>