diff --git a/.buildscript/deploy_snapshot.sh b/.buildscript/deploy_snapshot.sh
index 50ff0cb..bef978b 100755
--- a/.buildscript/deploy_snapshot.sh
+++ b/.buildscript/deploy_snapshot.sh
@@ -21,6 +21,6 @@ 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" -Dmaven.test.skip=true
+ ./gradlew uploadArchives
echo "Snapshot deployed!"
fi
diff --git a/.buildscript/settings.xml b/.buildscript/settings.xml
deleted file mode 100644
index 91f444b..0000000
--- a/.buildscript/settings.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-
-
-
- sonatype-nexus-snapshots
- ${env.CI_DEPLOY_USERNAME}
- ${env.CI_DEPLOY_PASSWORD}
-
-
-
diff --git a/.gitignore b/.gitignore
index 505a9aa..905e963 100644
--- a/.gitignore
+++ b/.gitignore
@@ -23,3 +23,5 @@ classes
obj
.DS_Store
+
+.gradle
diff --git a/.mvn/wrapper/MavenWrapperDownloader.java b/.mvn/wrapper/MavenWrapperDownloader.java
deleted file mode 100644
index b901097..0000000
--- a/.mvn/wrapper/MavenWrapperDownloader.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- * Copyright 2007-present the original author or authors.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-import java.net.*;
-import java.io.*;
-import java.nio.channels.*;
-import java.util.Properties;
-
-public class MavenWrapperDownloader {
-
- private static final String WRAPPER_VERSION = "0.5.6";
- /**
- * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
- */
- private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
- + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
-
- /**
- * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
- * use instead of the default one.
- */
- private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
- ".mvn/wrapper/maven-wrapper.properties";
-
- /**
- * Path where the maven-wrapper.jar will be saved to.
- */
- private static final String MAVEN_WRAPPER_JAR_PATH =
- ".mvn/wrapper/maven-wrapper.jar";
-
- /**
- * Name of the property which should be used to override the default download url for the wrapper.
- */
- private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
-
- public static void main(String args[]) {
- System.out.println("- Downloader started");
- File baseDirectory = new File(args[0]);
- System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
-
- // If the maven-wrapper.properties exists, read it and check if it contains a custom
- // wrapperUrl parameter.
- File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
- String url = DEFAULT_DOWNLOAD_URL;
- if(mavenWrapperPropertyFile.exists()) {
- FileInputStream mavenWrapperPropertyFileInputStream = null;
- try {
- mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
- Properties mavenWrapperProperties = new Properties();
- mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
- url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
- } catch (IOException e) {
- System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
- } finally {
- try {
- if(mavenWrapperPropertyFileInputStream != null) {
- mavenWrapperPropertyFileInputStream.close();
- }
- } catch (IOException e) {
- // Ignore ...
- }
- }
- }
- System.out.println("- Downloading from: " + url);
-
- File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
- if(!outputFile.getParentFile().exists()) {
- if(!outputFile.getParentFile().mkdirs()) {
- System.out.println(
- "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
- }
- }
- System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
- try {
- downloadFileFromURL(url, outputFile);
- System.out.println("Done");
- System.exit(0);
- } catch (Throwable e) {
- System.out.println("- Error downloading");
- e.printStackTrace();
- System.exit(1);
- }
- }
-
- private static void downloadFileFromURL(String urlString, File destination) throws Exception {
- if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
- String username = System.getenv("MVNW_USERNAME");
- char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
- Authenticator.setDefault(new Authenticator() {
- @Override
- protected PasswordAuthentication getPasswordAuthentication() {
- return new PasswordAuthentication(username, password);
- }
- });
- }
- URL website = new URL(urlString);
- ReadableByteChannel rbc;
- rbc = Channels.newChannel(website.openStream());
- FileOutputStream fos = new FileOutputStream(destination);
- fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
- fos.close();
- rbc.close();
- }
-
-}
diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar
deleted file mode 100644
index 2cc7d4a..0000000
Binary files a/.mvn/wrapper/maven-wrapper.jar and /dev/null differ
diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties
deleted file mode 100644
index 642d572..0000000
--- a/.mvn/wrapper/maven-wrapper.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
-wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
diff --git a/.travis.yml b/.travis.yml
index 27d2660..167dbb9 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -3,6 +3,9 @@ language: java
jdk:
- openjdk8
+script:
+ - ./gradlew build check
+
after_success:
- .buildscript/deploy_snapshot.sh
@@ -18,6 +21,11 @@ branches:
notifications:
email: false
+before_cache:
+ - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
+ - rm -fr $HOME/.gradle/caches/*/plugin-resolution/
+
cache:
directories:
- - $HOME/.m2
+ - $HOME/.gradle/caches/
+ - $HOME/.gradle/wrapper/
\ No newline at end of file
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index e42a02a..13a1db5 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -6,9 +6,9 @@ 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 `./mvnw 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.
+failing project's `build/reports/checkstyle` directory.
Before your code can be accepted into the project you must also sign the
[Individual Contributor License Agreement (CLA)][1].
diff --git a/adapters/build.gradle.kts b/adapters/build.gradle.kts
new file mode 100644
index 0000000..db9faf4
--- /dev/null
+++ b/adapters/build.gradle.kts
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2020 Square, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+plugins {
+ `java-library`
+ id("com.vanniktech.maven.publish")
+}
+
+dependencies {
+ compileOnly(Dependencies.jsr305)
+ api(project(":moshi"))
+
+ testCompileOnly(Dependencies.jsr305)
+ testImplementation(Dependencies.Testing.junit)
+ testImplementation(Dependencies.Testing.assertj)
+}
diff --git a/adapters/gradle.properties b/adapters/gradle.properties
new file mode 100644
index 0000000..32c667b
--- /dev/null
+++ b/adapters/gradle.properties
@@ -0,0 +1,20 @@
+#
+# Copyright (C) 2020 Square, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+POM_NAME=Moshi Adapters
+POM_ARTIFACT_ID=moshi-adapters
+POM_PACKAGING=jar
+AUTOMATIC_MODULE_NAME=com.squareup.moshi.adapters
diff --git a/adapters/pom.xml b/adapters/pom.xml
deleted file mode 100644
index af035c5..0000000
--- a/adapters/pom.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-
-
-
- 4.0.0
-
-
- com.squareup.moshi
- moshi-parent
- 1.11.0-SNAPSHOT
-
-
- moshi-adapters
-
-
-
- com.squareup.moshi
- moshi
- ${project.version}
-
-
- com.google.code.findbugs
- jsr305
- provided
-
-
- junit
- junit
- test
-
-
- org.assertj
- assertj-core
- test
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-jar-plugin
-
-
-
- com.squareup.moshi.adapters
-
-
-
-
-
-
-
diff --git a/build.gradle.kts b/build.gradle.kts
new file mode 100644
index 0000000..f63ef94
--- /dev/null
+++ b/build.gradle.kts
@@ -0,0 +1,89 @@
+/*
+ * Copyright (C) 2020 Square, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import com.vanniktech.maven.publish.MavenPublishPluginExtension
+import org.gradle.jvm.tasks.Jar
+
+buildscript {
+ dependencies {
+ classpath(kotlin("gradle-plugin", version = Dependencies.Kotlin.version))
+ }
+}
+
+plugins {
+ id("com.vanniktech.maven.publish") version "0.11.1" apply false
+ id("org.jetbrains.dokka") version "0.10.1" apply false
+}
+
+subprojects {
+ repositories {
+ mavenCentral()
+ @Suppress("UnstableApiUsage")
+ exclusiveContent {
+ forRepository {
+ maven {
+ name = "JCenter"
+ setUrl("https://jcenter.bintray.com/")
+ }
+ }
+ filter {
+ includeModule("org.jetbrains.dokka", "dokka-fatjar")
+ }
+ }
+ }
+
+// apply(plugin = "checkstyle")
+// configure {
+// toolVersion = "8.28"
+// configFile = rootProject.file("checkstyle.xml")
+// }
+// tasks.withType().configureEach {
+// exclude("**/Iso8601Utils.java")
+// }
+
+ pluginManager.withPlugin("java-library") {
+ configure {
+ sourceCompatibility = JavaVersion.VERSION_1_7
+ targetCompatibility = JavaVersion.VERSION_1_7
+ }
+ }
+
+ // Configure publishing
+ pluginManager.withPlugin("com.vanniktech.maven.publish") {
+ configure {
+ useLegacyMode = false
+ nexus {
+ groupId = "com.squareup"
+ }
+ }
+
+ // Configure automatic-module-name, but only for published modules
+ @Suppress("UnstableApiUsage")
+ val automaticModuleName = providers.gradleProperty("AUTOMATIC_MODULE_NAME")
+ .forUseAtConfigurationTime()
+ if (automaticModuleName.isPresent) {
+ val name = automaticModuleName.get()
+ tasks.withType().configureEach {
+ manifest {
+ attributes("Automatic-Module-Name" to name)
+ }
+ }
+ }
+ }
+
+ pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
+ dependencies.add("api", Dependencies.Kotlin.stdlib)
+ }
+}
diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts
new file mode 100644
index 0000000..37acc02
--- /dev/null
+++ b/buildSrc/build.gradle.kts
@@ -0,0 +1,23 @@
+/*
+ * Copyright (C) 2020 Square, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+plugins {
+ `kotlin-dsl`
+}
+
+repositories {
+ mavenCentral()
+}
diff --git a/buildSrc/src/main/kotlin/Dependencies.kt b/buildSrc/src/main/kotlin/Dependencies.kt
new file mode 100644
index 0000000..43413f3
--- /dev/null
+++ b/buildSrc/src/main/kotlin/Dependencies.kt
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2020 Square, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+object Dependencies {
+
+ const val asm = "org.ow2.asm:asm:7.1"
+ const val jsr305 = "com.google.code.findbugs:jsr305:3.0.2"
+ const val okio = "com.squareup.okio:okio:1.16.0"
+ const val okio2 = "com.squareup.okio:okio:2.1.0"
+
+ object AutoService {
+ private const val version = "1.0-rc7"
+ const val annotations = "com.google.auto.service:auto-service-annotations:$version"
+ const val processor = "com.google.auto.service:auto-service:$version"
+ }
+
+ object Incap {
+ private const val version = "0.3"
+ const val annotations = "net.ltgt.gradle.incap:incap:$version"
+ const val processor = "net.ltgt.gradle.incap:incap-processor:$version"
+ }
+
+ object Kotlin {
+ const val version = "1.4.0"
+ const val stdlib = "org.jetbrains.kotlin:kotlin-stdlib:$version"
+ const val metadata = "org.jetbrains.kotlinx:kotlinx-metadata-jvm:0.1.0"
+ }
+
+ object KotlinPoet {
+ private const val version = "1.6.0"
+ const val kotlinPoet = "com.squareup:kotlinpoet:$version"
+ const val metadata = "com.squareup:kotlinpoet-metadata-specs:$version"
+ const val metadataSpecs = "com.squareup:kotlinpoet-metadata-specs:$version"
+ const val elementsClassInspector = "com.squareup:kotlinpoet-classinspector-elements:$version"
+ }
+
+ object Testing {
+ const val assertj = "org.assertj:assertj-core:3.11.1"
+ const val compileTesting = "com.github.tschuchortdev:kotlin-compile-testing:1.2.8"
+ const val junit = "junit:junit:4.12"
+ const val truth = "com.google.truth:truth:1.0"
+ }
+}
\ No newline at end of file
diff --git a/checkstyle.xml b/checkstyle.xml
index 1e4d8e6..f66aad5 100644
--- a/checkstyle.xml
+++ b/checkstyle.xml
@@ -28,8 +28,6 @@
-
-
diff --git a/examples/build.gradle.kts b/examples/build.gradle.kts
new file mode 100644
index 0000000..5a2b654
--- /dev/null
+++ b/examples/build.gradle.kts
@@ -0,0 +1,25 @@
+/*
+ * Copyright (C) 2020 Square, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+plugins {
+ `java-library`
+}
+
+dependencies {
+ compileOnly(Dependencies.jsr305)
+ implementation(project(":moshi"))
+ implementation(project(":adapters"))
+}
diff --git a/examples/pom.xml b/examples/pom.xml
deleted file mode 100644
index e35f93d..0000000
--- a/examples/pom.xml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
- 4.0.0
-
-
- com.squareup.moshi
- moshi-parent
- 1.11.0-SNAPSHOT
-
-
- moshi-examples
-
-
-
- com.google.code.findbugs
- jsr305
- provided
-
-
- com.squareup.moshi
- moshi
- ${project.version}
-
-
- com.squareup.moshi
- moshi-adapters
- ${project.version}
-
-
-
diff --git a/gradle.properties b/gradle.properties
new file mode 100644
index 0000000..ebd8621
--- /dev/null
+++ b/gradle.properties
@@ -0,0 +1,31 @@
+#
+# Copyright (C) 2020 Square, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+kapt.includeCompileClasspath=false
+
+GROUP=com.squareup.moshi
+VERSION_NAME=1.11.0-SNAPSHOT
+POM_DESCRIPTION=A modern JSON API for Android and Java
+POM_URL=https://github.com/square/moshi/
+POM_SCM_URL=https://github.com/square/moshi/
+POM_SCM_CONNECTION=scm:git:git://github.com/square/moshi.git
+POM_SCM_DEV_CONNECTION=scm:git:ssh://git@github.com/square/moshi.git
+POM_LICENCE_NAME=The Apache Software License, Version 2.0
+POM_LICENCE_URL=https://www.apache.org/licenses/LICENSE-2.0.txt
+POM_LICENCE_DIST=repo
+POM_DEVELOPER_ID=square
+POM_DEVELOPER_NAME=Square, Inc.
+POM_DEVELOPER_URL=https://github.com/square/
diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar
new file mode 100644
index 0000000..62d4c05
Binary files /dev/null and b/gradle/wrapper/gradle-wrapper.jar differ
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
new file mode 100644
index 0000000..186b715
--- /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-all.zip
+zipStoreBase=GRADLE_USER_HOME
+zipStorePath=wrapper/dists
diff --git a/gradlew b/gradlew
new file mode 100755
index 0000000..fbd7c51
--- /dev/null
+++ b/gradlew
@@ -0,0 +1,185 @@
+#!/usr/bin/env sh
+
+#
+# Copyright 2015 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+##
+## 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" "-Xms64m"'
+
+# 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 or MSYS, switch paths to Windows format before running java
+if [ "$cygwin" = "true" -o "$msys" = "true" ] ; 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=`expr $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"
+
+exec "$JAVACMD" "$@"
diff --git a/gradlew.bat b/gradlew.bat
new file mode 100644
index 0000000..5093609
--- /dev/null
+++ b/gradlew.bat
@@ -0,0 +1,104 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@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 Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@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" "-Xms64m"
+
+@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/kotlin/codegen/build.gradle.kts b/kotlin/codegen/build.gradle.kts
new file mode 100644
index 0000000..8939bbe
--- /dev/null
+++ b/kotlin/codegen/build.gradle.kts
@@ -0,0 +1,108 @@
+/*
+ * Copyright (C) 2020 Square, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import com.github.jengelman.gradle.plugins.shadow.tasks.ConfigureShadowRelocation
+import com.github.jengelman.gradle.plugins.shadow.transformers.ServiceFileTransformer
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+
+plugins {
+ kotlin("jvm")
+ kotlin("kapt")
+ id("com.vanniktech.maven.publish")
+ id("com.github.johnrengelman.shadow") version "5.2.0"
+}
+
+tasks.withType().configureEach {
+ kotlinOptions {
+ jvmTarget = "1.8"
+ freeCompilerArgs = listOf(
+ "-progressive",
+ "-Xopt-in=com.squareup.kotlinpoet.metadata.KotlinPoetMetadataPreview"
+ )
+ }
+}
+
+val shade: Configuration = configurations.maybeCreate("compileShaded")
+configurations.getByName("compileOnly").extendsFrom(shade)
+dependencies {
+ implementation(project(":moshi"))
+ implementation(kotlin("reflect"))
+ shade(Dependencies.Kotlin.metadata) {
+ exclude(group = "org.jetbrains.kotlin", module = "kotlin-stdlib")
+ }
+ implementation(Dependencies.KotlinPoet.kotlinPoet)
+ shade(Dependencies.KotlinPoet.metadata) {
+ exclude(group = "org.jetbrains.kotlin")
+ }
+ shade(Dependencies.KotlinPoet.metadataSpecs) {
+ exclude(group = "org.jetbrains.kotlin")
+ }
+ shade(Dependencies.KotlinPoet.elementsClassInspector) {
+ exclude(group = "org.jetbrains.kotlin")
+ }
+ implementation(Dependencies.asm)
+
+ implementation(Dependencies.AutoService.annotations)
+ kapt(Dependencies.AutoService.processor)
+ implementation(Dependencies.Incap.annotations)
+ kapt(Dependencies.Incap.processor)
+
+ // Copy these again as they're not automatically included since they're shaded
+ testImplementation(Dependencies.KotlinPoet.metadata)
+ testImplementation(Dependencies.KotlinPoet.metadataSpecs)
+ testImplementation(Dependencies.KotlinPoet.elementsClassInspector)
+ testImplementation(Dependencies.Testing.junit)
+ testImplementation(Dependencies.Testing.assertj)
+ testImplementation(Dependencies.Testing.truth)
+ testImplementation(Dependencies.Testing.compileTesting)
+ testImplementation(Dependencies.okio2)
+}
+
+val relocateShadowJar = tasks.register("relocateShadowJar") {
+ target = tasks.shadowJar.get()
+}
+
+val shadowJar = tasks.shadowJar.apply {
+ configure {
+ dependsOn(relocateShadowJar)
+ archiveClassifier.set("")
+ configurations = listOf(shade)
+ relocate("com.squareup.kotlinpoet.metadata", "com.squareup.moshi.kotlinpoet.metadata")
+ relocate("com.squareup.kotlinpoet.classinspector",
+ "com.squareup.moshi.kotlinpoet.classinspector")
+ relocate("kotlinx.metadata", "com.squareup.moshi.kotlinx.metadata")
+ transformers.add(ServiceFileTransformer())
+ }
+}
+
+artifacts {
+ runtime(shadowJar)
+ archives(shadowJar)
+}
+
+// Shadow plugin doesn't natively support gradle metadata, so we have to tell the maven plugin where
+// to get a jar now.
+afterEvaluate {
+ configure {
+ publications.withType().configureEach {
+ if (name == "pluginMaven") {
+ // This is to properly wire the shadow jar's gradle metadata and pom information
+ setArtifacts(artifacts.matching { it.classifier != "" })
+ // Ugly but artifact() doesn't support TaskProviders
+ artifact(shadowJar.get())
+ }
+ }
+ }
+}
diff --git a/kotlin/codegen/gradle.properties b/kotlin/codegen/gradle.properties
new file mode 100644
index 0000000..b534f6c
--- /dev/null
+++ b/kotlin/codegen/gradle.properties
@@ -0,0 +1,19 @@
+#
+# Copyright (C) 2020 Square, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+POM_NAME=Moshi Kotlin Codegen
+POM_ARTIFACT_ID=moshi-kotlin-codegen
+POM_PACKAGING=jar
diff --git a/kotlin/codegen/pom.xml b/kotlin/codegen/pom.xml
deleted file mode 100644
index 59d65c0..0000000
--- a/kotlin/codegen/pom.xml
+++ /dev/null
@@ -1,269 +0,0 @@
-
-
-
- 4.0.0
-
-
- com.squareup.moshi
- moshi-parent
- 1.11.0-SNAPSHOT
- ../../pom.xml
-
-
- moshi-kotlin-codegen
-
-
-
- com.squareup.moshi
- moshi
- ${project.version}
-
-
- org.jetbrains.kotlin
- kotlin-stdlib
-
-
- com.squareup
- kotlinpoet
- ${kotlinpoet.version}
-
-
- org.jetbrains.kotlinx
- kotlinx-metadata-jvm
- ${kotlinx-metadata.version}
-
-
- com.squareup
- kotlinpoet-metadata
- ${kotlinpoet.version}
-
-
- com.squareup
- kotlinpoet-metadata-specs
- ${kotlinpoet.version}
-
-
- com.squareup
- kotlinpoet-classinspector-elements
- ${kotlinpoet.version}
-
-
- org.ow2.asm
- asm
- ${asm.version}
-
-
- net.ltgt.gradle.incap
- incap
- ${incap.version}
- provided
- true
-
-
- com.google.auto.service
- auto-service-annotations
- ${auto-service.version}
- provided
- true
-
-
- junit
- junit
- test
-
-
- org.assertj
- assertj-core
- test
-
-
- com.google.truth
- truth
- ${truth.version}
- test
-
-
-
-
- com.github.tschuchortdev
- kotlin-compile-testing
- ${kotlin-compile-testing.version}
- test
-
-
- com.squareup.okio
- okio
- ${okio2.version}
- test
-
-
-
-
- true
- 1.8
-
-
-
-
-
- org.jetbrains.kotlin
- kotlin-maven-plugin
- ${kotlin.version}
-
-
- kapt
-
- kapt
-
-
-
- src/main/kotlin
- src/main/java
-
-
-
- com.google.auto.service
- auto-service
- ${auto-service.version}
-
-
- net.ltgt.gradle.incap
- incap-processor
- ${incap.version}
-
-
-
-
-
- compile
- compile
-
- compile
-
-
-
- test-compile
- test-compile
-
- test-compile
-
-
-
-
-
-
- -Xopt-in=com.squareup.kotlinpoet.metadata.KotlinPoetMetadataPreview
- -Xopt-in=kotlin.OptIn
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
-
- compile
- compile
-
- compile
-
-
-
- testCompile
- test-compile
-
- testCompile
-
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
- 2.21.0
-
-
- false
-
-
-
- org.apache.maven.plugins
- maven-shade-plugin
- 3.2.0
-
-
- package
-
- shade
-
-
-
-
- com.squareup:kotlinpoet-metadata
- com.squareup:kotlinpoet-metadata-specs
- com.squareup:kotlinpoet-classinspector-elements
- org.jetbrains.kotlinx:kotlinx-metadata-jvm
-
-
-
-
-
-
-
-
- com.squareup.kotlinpoet.metadata
- com.squareup.moshi.kotlinpoet.metadata
-
-
- com.squareup.kotlinpoet.classinspector
- com.squareup.moshi.kotlinpoet.classinspector
-
-
- kotlinx.metadata
- com.squareup.moshi.kotlinx.metadata
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
- ${maven-assembly.version}
-
-
- package
-
- single
-
-
-
-
-
- src/assembly/dokka.xml
-
-
-
-
- org.jetbrains.dokka
- dokka-maven-plugin
- ${dokka.version}
-
-
- prepare-package
-
- dokka
-
-
-
-
-
-
-
diff --git a/kotlin/codegen/src/assembly/dokka.xml b/kotlin/codegen/src/assembly/dokka.xml
deleted file mode 100644
index b763232..0000000
--- a/kotlin/codegen/src/assembly/dokka.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
- javadoc
-
- jar
-
- /
-
-
- target/dokka/moshi-kotlin-codegen
- /
-
-
-
diff --git a/kotlin/codegen/src/main/java/com/squareup/moshi/kotlin/codegen/JsonClassCodegenProcessor.kt b/kotlin/codegen/src/main/java/com/squareup/moshi/kotlin/codegen/JsonClassCodegenProcessor.kt
index 3c03a9c..330d97a 100644
--- a/kotlin/codegen/src/main/java/com/squareup/moshi/kotlin/codegen/JsonClassCodegenProcessor.kt
+++ b/kotlin/codegen/src/main/java/com/squareup/moshi/kotlin/codegen/JsonClassCodegenProcessor.kt
@@ -19,7 +19,6 @@ import com.google.auto.service.AutoService
import com.squareup.kotlinpoet.AnnotationSpec
import com.squareup.kotlinpoet.asClassName
import com.squareup.kotlinpoet.classinspector.elements.ElementsClassInspector
-import com.squareup.kotlinpoet.metadata.KotlinPoetMetadataPreview
import com.squareup.moshi.JsonClass
import com.squareup.moshi.kotlin.codegen.api.AdapterGenerator
import com.squareup.moshi.kotlin.codegen.api.PropertyGenerator
@@ -45,7 +44,6 @@ import javax.tools.Diagnostic
* The generated class will match the visibility of the given data class (i.e. if it's internal, the
* adapter will also be internal).
*/
-@KotlinPoetMetadataPreview
@AutoService(Processor::class)
@IncrementalAnnotationProcessor(ISOLATING)
class JsonClassCodegenProcessor : AbstractProcessor() {
diff --git a/kotlin/codegen/src/main/java/com/squareup/moshi/kotlin/codegen/metadata.kt b/kotlin/codegen/src/main/java/com/squareup/moshi/kotlin/codegen/metadata.kt
index 08c630f..cc69f4d 100644
--- a/kotlin/codegen/src/main/java/com/squareup/moshi/kotlin/codegen/metadata.kt
+++ b/kotlin/codegen/src/main/java/com/squareup/moshi/kotlin/codegen/metadata.kt
@@ -45,6 +45,7 @@ import com.squareup.moshi.kotlin.codegen.api.TargetParameter
import com.squareup.moshi.kotlin.codegen.api.TargetProperty
import com.squareup.moshi.kotlin.codegen.api.TargetType
import com.squareup.moshi.kotlin.codegen.api.mapTypes
+import com.squareup.moshi.kotlin.codegen.api.rawType
import java.lang.annotation.ElementType
import java.lang.annotation.Retention
import java.lang.annotation.RetentionPolicy
@@ -365,7 +366,7 @@ private fun declaredProperties(
return result
}
-private val TargetProperty.isTransient get() = propertySpec.annotations.any { it.className == Transient::class.asClassName() }
+private val TargetProperty.isTransient get() = propertySpec.annotations.any { it.typeName == Transient::class.asClassName() }
private val TargetProperty.isSettable get() = propertySpec.mutable || parameter != null
private val TargetProperty.isVisible: Boolean
get() {
@@ -406,19 +407,20 @@ internal fun TargetProperty.generator(
// Merge parameter and property annotations
val qualifiers = parameter?.qualifiers.orEmpty() + propertySpec.annotations.qualifiers(elements)
for (jsonQualifier in qualifiers) {
+ val qualifierRawType = jsonQualifier.typeName.rawType()
// Check Java types since that covers both Java and Kotlin annotations.
- val annotationElement = elements.getTypeElement(jsonQualifier.className.canonicalName)
+ val annotationElement = elements.getTypeElement(qualifierRawType.canonicalName)
?: continue
annotationElement.getAnnotation(Retention::class.java)?.let {
if (it.value != RetentionPolicy.RUNTIME) {
messager.printMessage(ERROR,
- "JsonQualifier @${jsonQualifier.className.simpleName} must have RUNTIME retention")
+ "JsonQualifier @${qualifierRawType.simpleName} must have RUNTIME retention")
}
}
annotationElement.getAnnotation(Target::class.java)?.let {
if (ElementType.FIELD !in it.value) {
messager.printMessage(ERROR,
- "JsonQualifier @${jsonQualifier.className.simpleName} must support FIELD target")
+ "JsonQualifier @${qualifierRawType.simpleName} must support FIELD target")
}
}
}
@@ -436,13 +438,13 @@ internal fun TargetProperty.generator(
private fun List?.qualifiers(elements: Elements): Set {
if (this == null) return setOf()
return filterTo(mutableSetOf()) {
- elements.getTypeElement(it.className.toString()).getAnnotation(JSON_QUALIFIER) != null
+ elements.getTypeElement(it.typeName.toString()).getAnnotation(JSON_QUALIFIER) != null
}
}
private fun List?.jsonName(): String? {
if (this == null) return null
- return find { it.className == JSON }?.let { annotation ->
+ return find { it.typeName == JSON }?.let { annotation ->
val mirror = requireNotNull(annotation.tag()) {
"Could not get the annotation mirror from the annotation spec"
}
diff --git a/kotlin/codegen/src/test/java/com/squareup/moshi/kotlin/codegen/JsonClassCodegenProcessorTest.kt b/kotlin/codegen/src/test/java/com/squareup/moshi/kotlin/codegen/JsonClassCodegenProcessorTest.kt
index 0e88965..fbf2888 100644
--- a/kotlin/codegen/src/test/java/com/squareup/moshi/kotlin/codegen/JsonClassCodegenProcessorTest.kt
+++ b/kotlin/codegen/src/test/java/com/squareup/moshi/kotlin/codegen/JsonClassCodegenProcessorTest.kt
@@ -15,7 +15,6 @@
*/
package com.squareup.moshi.kotlin.codegen
-import com.squareup.kotlinpoet.metadata.KotlinPoetMetadataPreview
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.JsonReader
import com.tschuchort.compiletesting.KotlinCompilation
@@ -36,7 +35,6 @@ import kotlin.reflect.full.createType
import kotlin.reflect.full.declaredMemberProperties
/** Execute kotlinc to confirm that either files are generated or errors are printed. */
-@OptIn(KotlinPoetMetadataPreview::class)
class JsonClassCodegenProcessorTest {
@Rule @JvmField var temporaryFolder: TemporaryFolder = TemporaryFolder()
diff --git a/kotlin/reflect/build.gradle.kts b/kotlin/reflect/build.gradle.kts
new file mode 100644
index 0000000..df15f03
--- /dev/null
+++ b/kotlin/reflect/build.gradle.kts
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2020 Square, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+plugins {
+ kotlin("jvm")
+ id("com.vanniktech.maven.publish")
+}
+
+dependencies {
+ api(project(":moshi"))
+ api(kotlin("reflect"))
+
+ testImplementation(kotlin("test"))
+ testImplementation(Dependencies.Testing.junit)
+ testImplementation(Dependencies.Testing.assertj)
+}
diff --git a/kotlin/reflect/gradle.properties b/kotlin/reflect/gradle.properties
new file mode 100644
index 0000000..fca827a
--- /dev/null
+++ b/kotlin/reflect/gradle.properties
@@ -0,0 +1,20 @@
+#
+# Copyright (C) 2020 Square, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+POM_NAME=Moshi Kotlin
+POM_ARTIFACT_ID=moshi-kotlin
+POM_PACKAGING=jar
+AUTOMATIC_MODULE_NAME=com.squareup.moshi.kotlin
diff --git a/kotlin/reflect/pom.xml b/kotlin/reflect/pom.xml
deleted file mode 100644
index b73dc88..0000000
--- a/kotlin/reflect/pom.xml
+++ /dev/null
@@ -1,137 +0,0 @@
-
-
-
- 4.0.0
-
-
- com.squareup.moshi
- moshi-parent
- 1.11.0-SNAPSHOT
- ../../pom.xml
-
-
- moshi-kotlin
-
-
-
- com.squareup.moshi
- moshi
- ${project.version}
-
-
- junit
- junit
- test
-
-
- org.assertj
- assertj-core
- test
-
-
- org.jetbrains.kotlin
- kotlin-stdlib
-
-
- org.jetbrains.kotlin
- kotlin-reflect
-
-
- org.jetbrains.kotlin
- kotlin-test
- test
-
-
-
-
- true
-
-
-
-
-
- org.jetbrains.kotlin
- kotlin-maven-plugin
- ${kotlin.version}
-
-
- compile
- compile
-
- compile
-
-
-
- test-compile
- test-compile
-
- test-compile
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
-
- compile
- compile
-
- compile
-
-
-
- testCompile
- test-compile
-
- testCompile
-
-
-
-
-
- org.apache.maven.plugins
- maven-jar-plugin
-
-
-
- com.squareup.moshi.kotlin
-
-
-
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
- ${maven-assembly.version}
-
-
- package
-
- single
-
-
-
-
-
- src/assembly/dokka.xml
-
-
-
-
- org.jetbrains.dokka
- dokka-maven-plugin
- ${dokka.version}
-
-
- prepare-package
-
- dokka
-
-
-
-
-
-
-
diff --git a/kotlin/reflect/src/assembly/dokka.xml b/kotlin/reflect/src/assembly/dokka.xml
deleted file mode 100644
index 1ca7f3c..0000000
--- a/kotlin/reflect/src/assembly/dokka.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
- javadoc
-
- jar
-
- /
-
-
- target/dokka/moshi-kotlin
- /
-
-
-
diff --git a/kotlin/reflect/src/main/test/java/com/squareup/moshi/kotlin/reflect/KotlinJsonAdapterTest.kt b/kotlin/reflect/src/test/java/com/squareup/moshi/kotlin/reflect/KotlinJsonAdapterTest.kt
similarity index 96%
rename from kotlin/reflect/src/main/test/java/com/squareup/moshi/kotlin/reflect/KotlinJsonAdapterTest.kt
rename to kotlin/reflect/src/test/java/com/squareup/moshi/kotlin/reflect/KotlinJsonAdapterTest.kt
index 9986632..6d07559 100644
--- a/kotlin/reflect/src/main/test/java/com/squareup/moshi/kotlin/reflect/KotlinJsonAdapterTest.kt
+++ b/kotlin/reflect/src/test/java/com/squareup/moshi/kotlin/reflect/KotlinJsonAdapterTest.kt
@@ -9,7 +9,6 @@ class KotlinJsonAdapterTest {
@JsonClass(generateAdapter = true)
class Data
- @ExperimentalStdlibApi
@Test
fun fallsBackToReflectiveAdapterWithoutCodegen() {
val moshi = Moshi.Builder()
diff --git a/kotlin/tests/build.gradle.kts b/kotlin/tests/build.gradle.kts
new file mode 100644
index 0000000..038c0a7
--- /dev/null
+++ b/kotlin/tests/build.gradle.kts
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2020 Square, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
+
+plugins {
+ kotlin("jvm")
+ kotlin("kapt")
+}
+
+tasks.withType().configureEach {
+ kotlinOptions {
+ freeCompilerArgs = listOf(
+ "-Werror",
+ "-Xopt-in=kotlin.ExperimentalStdlibApi",
+ "-Xinline-classes"
+ )
+ }
+}
+
+dependencies {
+ kaptTest(project(":kotlin:codegen"))
+ testImplementation(project(":moshi"))
+ testImplementation(project(":kotlin:reflect"))
+ testImplementation(kotlin("reflect"))
+ testImplementation(Dependencies.Testing.junit)
+ testImplementation(Dependencies.Testing.assertj)
+ testImplementation(Dependencies.Testing.truth)
+ testImplementation(Dependencies.okio2)
+}
diff --git a/kotlin/tests/pom.xml b/kotlin/tests/pom.xml
deleted file mode 100644
index a043428..0000000
--- a/kotlin/tests/pom.xml
+++ /dev/null
@@ -1,193 +0,0 @@
-
-
-
- 4.0.0
-
-
- com.squareup.moshi
- moshi-parent
- 1.11.0-SNAPSHOT
- ../../pom.xml
-
-
- moshi-kotlin-tests
-
-
-
- com.squareup.moshi
- moshi
- ${project.version}
-
-
- com.squareup.moshi
- moshi-kotlin
- ${project.version}
-
-
- org.jetbrains.kotlin
- kotlin-stdlib
-
-
- junit
- junit
- test
-
-
- org.assertj
- assertj-core
- test
-
-
-
-
- true
-
-
-
-
-
- kotlin-maven-plugin
- org.jetbrains.kotlin
- ${kotlin.version}
-
-
- kapt
-
- kapt
-
-
-
- src/main/kotlin
-
-
-
- com.squareup.moshi
- moshi-kotlin-codegen
- ${project.version}
-
-
-
-
-
- compile
-
- compile
-
-
-
- src/main/kotlin
- src/main/java
-
-
-
-
- test-kapt
-
- test-kapt
-
-
-
- src/test/kotlin
- src/test/java
-
-
-
- com.squareup.moshi
- moshi-kotlin-codegen
- ${project.version}
-
-
-
-
-
- test-compile
-
- test-compile
-
-
-
- src/test/kotlin
- src/test/java
- target/generated-sources/kapt/test
-
-
-
-
-
-
- -Werror
- -Xopt-in=kotlin.ExperimentalStdlibApi
- -XXLanguage:+InlineClasses
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.5.1
-
- none
- 1.6
- 1.6
-
-
-
-
- default-compile
- none
-
-
-
- default-testCompile
- none
-
-
- java-compile
- compile
-
- compile
-
-
-
- java-test-compile
- test-compile
-
- testCompile
-
-
-
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
- ${maven-assembly.version}
-
-
- package
-
- single
-
-
-
-
-
- src/assembly/dokka.xml
-
-
-
-
- org.jetbrains.dokka
- dokka-maven-plugin
- ${dokka.version}
-
-
- prepare-package
-
- dokka
-
-
-
-
-
-
-
diff --git a/kotlin/tests/src/assembly/dokka.xml b/kotlin/tests/src/assembly/dokka.xml
deleted file mode 100644
index d34d1dd..0000000
--- a/kotlin/tests/src/assembly/dokka.xml
+++ /dev/null
@@ -1,16 +0,0 @@
-
- javadoc
-
- jar
-
- /
-
-
- target/dokka/moshi-kotlin-tests
- /
-
-
-
diff --git a/kotlin/tests/src/test/kotlin/com/squareup/moshi/kotlin/codegen/ComplexGenericsInheritanceTest.kt b/kotlin/tests/src/test/kotlin/com/squareup/moshi/kotlin/codegen/ComplexGenericsInheritanceTest.kt
index a3a16f8..5459bd4 100644
--- a/kotlin/tests/src/test/kotlin/com/squareup/moshi/kotlin/codegen/ComplexGenericsInheritanceTest.kt
+++ b/kotlin/tests/src/test/kotlin/com/squareup/moshi/kotlin/codegen/ComplexGenericsInheritanceTest.kt
@@ -9,7 +9,6 @@ import org.assertj.core.api.Assertions.assertThat
import org.intellij.lang.annotations.Language
import org.junit.Test
-@ExperimentalStdlibApi
class ComplexGenericsInheritanceTest {
private val moshi = Moshi.Builder().build()
diff --git a/kotlin/tests/src/test/kotlin/com/squareup/moshi/kotlin/codegen/GeneratedAdaptersTest.kt b/kotlin/tests/src/test/kotlin/com/squareup/moshi/kotlin/codegen/GeneratedAdaptersTest.kt
index 46601cf..d1dde58 100644
--- a/kotlin/tests/src/test/kotlin/com/squareup/moshi/kotlin/codegen/GeneratedAdaptersTest.kt
+++ b/kotlin/tests/src/test/kotlin/com/squareup/moshi/kotlin/codegen/GeneratedAdaptersTest.kt
@@ -39,7 +39,6 @@ import kotlin.annotation.AnnotationTarget.TYPE
import kotlin.properties.Delegates
import kotlin.reflect.full.memberProperties
-@ExperimentalStdlibApi
@Suppress("UNUSED", "UNUSED_PARAMETER")
class GeneratedAdaptersTest {
diff --git a/kotlin/tests/src/test/kotlin/com/squareup/moshi/kotlin/reflect/-MoshiKotlinExtensions.kt b/kotlin/tests/src/test/kotlin/com/squareup/moshi/kotlin/reflect/-MoshiKotlinExtensions.kt
index 9983846..f8d01d8 100644
--- a/kotlin/tests/src/test/kotlin/com/squareup/moshi/kotlin/reflect/-MoshiKotlinExtensions.kt
+++ b/kotlin/tests/src/test/kotlin/com/squareup/moshi/kotlin/reflect/-MoshiKotlinExtensions.kt
@@ -32,12 +32,10 @@ import kotlin.reflect.typeOf
* @return a [JsonAdapter] for [T], creating it if necessary. Note that while nullability of [T]
* itself is handled, nested types (such as in generics) are not resolved.
*/
-@ExperimentalStdlibApi
inline fun Moshi.adapter(): JsonAdapter {
return adapter(typeOf())
}
-@ExperimentalStdlibApi
inline fun Moshi.Builder.addAdapter(adapter: JsonAdapter) = add(typeOf().toType(), adapter)
/**
diff --git a/moshi/build.gradle.kts b/moshi/build.gradle.kts
new file mode 100644
index 0000000..05b225d
--- /dev/null
+++ b/moshi/build.gradle.kts
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2020 Square, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+plugins {
+ `java-library`
+ id("com.vanniktech.maven.publish")
+}
+
+dependencies {
+ compileOnly(Dependencies.jsr305)
+ api(Dependencies.okio)
+
+ testCompileOnly(Dependencies.jsr305)
+ testImplementation(Dependencies.Testing.junit)
+ testImplementation(Dependencies.Testing.assertj)
+}
diff --git a/moshi/gradle.properties b/moshi/gradle.properties
new file mode 100644
index 0000000..4938af0
--- /dev/null
+++ b/moshi/gradle.properties
@@ -0,0 +1,20 @@
+#
+# Copyright (C) 2020 Square, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+POM_NAME=Moshi
+POM_ARTIFACT_ID=moshi
+POM_PACKAGING=jar
+AUTOMATIC_MODULE_NAME=com.squareup.moshi
diff --git a/moshi/pom.xml b/moshi/pom.xml
deleted file mode 100644
index d0cc76b..0000000
--- a/moshi/pom.xml
+++ /dev/null
@@ -1,63 +0,0 @@
-
-
-
- 4.0.0
-
-
- com.squareup.moshi
- moshi-parent
- 1.11.0-SNAPSHOT
-
-
- moshi
- Moshi
-
-
-
- com.squareup.okio
- okio
-
-
- com.google.code.findbugs
- jsr305
- provided
-
-
- junit
- junit
- test
-
-
- org.assertj
- assertj-core
- test
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-jar-plugin
-
-
-
- com.squareup.moshi
-
-
-
-
-
- org.apache.maven.plugins
- maven-javadoc-plugin
- 2.10.4
-
- com.squareup.moshi.internal:com.squareup.moshi.internal.*
-
- https://square.github.io/okio/
-
-
-
-
-
-
diff --git a/moshi/src/main/java/com/squareup/moshi/JsonClass.java b/moshi/src/main/java/com/squareup/moshi/JsonClass.java
index bbf55db..120b010 100644
--- a/moshi/src/main/java/com/squareup/moshi/JsonClass.java
+++ b/moshi/src/main/java/com/squareup/moshi/JsonClass.java
@@ -63,7 +63,7 @@ public @interface JsonClass {
*
*
The first parameter must be a {@link Moshi} instance.
*
- * If generic, a second {@link Type[]} parameter should be declared to accept type arguments.
+ * If generic, a second {@link Type Type[]} parameter should be declared to accept type arguments.
*
*
*
diff --git a/mvnw b/mvnw
deleted file mode 100755
index 41c0f0c..0000000
--- a/mvnw
+++ /dev/null
@@ -1,310 +0,0 @@
-#!/bin/sh
-# ----------------------------------------------------------------------------
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-# ----------------------------------------------------------------------------
-
-# ----------------------------------------------------------------------------
-# Maven Start Up Batch script
-#
-# Required ENV vars:
-# ------------------
-# JAVA_HOME - location of a JDK home dir
-#
-# Optional ENV vars
-# -----------------
-# M2_HOME - location of maven2's installed home dir
-# MAVEN_OPTS - parameters passed to the Java VM when running Maven
-# e.g. to debug Maven itself, use
-# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
-# MAVEN_SKIP_RC - flag to disable loading of mavenrc files
-# ----------------------------------------------------------------------------
-
-if [ -z "$MAVEN_SKIP_RC" ] ; then
-
- if [ -f /etc/mavenrc ] ; then
- . /etc/mavenrc
- fi
-
- if [ -f "$HOME/.mavenrc" ] ; then
- . "$HOME/.mavenrc"
- fi
-
-fi
-
-# OS specific support. $var _must_ be set to either true or false.
-cygwin=false;
-darwin=false;
-mingw=false
-case "`uname`" in
- CYGWIN*) cygwin=true ;;
- MINGW*) mingw=true;;
- Darwin*) darwin=true
- # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home
- # See https://developer.apple.com/library/mac/qa/qa1170/_index.html
- if [ -z "$JAVA_HOME" ]; then
- if [ -x "/usr/libexec/java_home" ]; then
- export JAVA_HOME="`/usr/libexec/java_home`"
- else
- export JAVA_HOME="/Library/Java/Home"
- fi
- fi
- ;;
-esac
-
-if [ -z "$JAVA_HOME" ] ; then
- if [ -r /etc/gentoo-release ] ; then
- JAVA_HOME=`java-config --jre-home`
- fi
-fi
-
-if [ -z "$M2_HOME" ] ; then
- ## resolve links - $0 may be a link to maven's home
- 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
-
- saveddir=`pwd`
-
- M2_HOME=`dirname "$PRG"`/..
-
- # make it fully qualified
- M2_HOME=`cd "$M2_HOME" && pwd`
-
- cd "$saveddir"
- # echo Using m2 at $M2_HOME
-fi
-
-# For Cygwin, ensure paths are in UNIX format before anything is touched
-if $cygwin ; then
- [ -n "$M2_HOME" ] &&
- M2_HOME=`cygpath --unix "$M2_HOME"`
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
- [ -n "$CLASSPATH" ] &&
- CLASSPATH=`cygpath --path --unix "$CLASSPATH"`
-fi
-
-# For Mingw, ensure paths are in UNIX format before anything is touched
-if $mingw ; then
- [ -n "$M2_HOME" ] &&
- M2_HOME="`(cd "$M2_HOME"; pwd)`"
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`"
-fi
-
-if [ -z "$JAVA_HOME" ]; then
- javaExecutable="`which javac`"
- if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then
- # readlink(1) is not available as standard on Solaris 10.
- readLink=`which readlink`
- if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then
- if $darwin ; then
- javaHome="`dirname \"$javaExecutable\"`"
- javaExecutable="`cd \"$javaHome\" && pwd -P`/javac"
- else
- javaExecutable="`readlink -f \"$javaExecutable\"`"
- fi
- javaHome="`dirname \"$javaExecutable\"`"
- javaHome=`expr "$javaHome" : '\(.*\)/bin'`
- JAVA_HOME="$javaHome"
- export JAVA_HOME
- fi
- fi
-fi
-
-if [ -z "$JAVACMD" ] ; then
- 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
- else
- JAVACMD="`which java`"
- fi
-fi
-
-if [ ! -x "$JAVACMD" ] ; then
- echo "Error: JAVA_HOME is not defined correctly." >&2
- echo " We cannot execute $JAVACMD" >&2
- exit 1
-fi
-
-if [ -z "$JAVA_HOME" ] ; then
- echo "Warning: JAVA_HOME environment variable is not set."
-fi
-
-CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher
-
-# traverses directory structure from process work directory to filesystem root
-# first directory with .mvn subdirectory is considered project base directory
-find_maven_basedir() {
-
- if [ -z "$1" ]
- then
- echo "Path not specified to find_maven_basedir"
- return 1
- fi
-
- basedir="$1"
- wdir="$1"
- while [ "$wdir" != '/' ] ; do
- if [ -d "$wdir"/.mvn ] ; then
- basedir=$wdir
- break
- fi
- # workaround for JBEAP-8937 (on Solaris 10/Sparc)
- if [ -d "${wdir}" ]; then
- wdir=`cd "$wdir/.."; pwd`
- fi
- # end of workaround
- done
- echo "${basedir}"
-}
-
-# concatenates all lines of a file
-concat_lines() {
- if [ -f "$1" ]; then
- echo "$(tr -s '\n' ' ' < "$1")"
- fi
-}
-
-BASE_DIR=`find_maven_basedir "$(pwd)"`
-if [ -z "$BASE_DIR" ]; then
- exit 1;
-fi
-
-##########################################################################################
-# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
-# This allows using the maven wrapper in projects that prohibit checking in binary data.
-##########################################################################################
-if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then
- if [ "$MVNW_VERBOSE" = true ]; then
- echo "Found .mvn/wrapper/maven-wrapper.jar"
- fi
-else
- if [ "$MVNW_VERBOSE" = true ]; then
- echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..."
- fi
- if [ -n "$MVNW_REPOURL" ]; then
- jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
- else
- jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
- fi
- while IFS="=" read key value; do
- case "$key" in (wrapperUrl) jarUrl="$value"; break ;;
- esac
- done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties"
- if [ "$MVNW_VERBOSE" = true ]; then
- echo "Downloading from: $jarUrl"
- fi
- wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar"
- if $cygwin; then
- wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"`
- fi
-
- if command -v wget > /dev/null; then
- if [ "$MVNW_VERBOSE" = true ]; then
- echo "Found wget ... using wget"
- fi
- if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
- wget "$jarUrl" -O "$wrapperJarPath"
- else
- wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath"
- fi
- elif command -v curl > /dev/null; then
- if [ "$MVNW_VERBOSE" = true ]; then
- echo "Found curl ... using curl"
- fi
- if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then
- curl -o "$wrapperJarPath" "$jarUrl" -f
- else
- curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f
- fi
-
- else
- if [ "$MVNW_VERBOSE" = true ]; then
- echo "Falling back to using Java to download"
- fi
- javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java"
- # For Cygwin, switch paths to Windows format before running javac
- if $cygwin; then
- javaClass=`cygpath --path --windows "$javaClass"`
- fi
- if [ -e "$javaClass" ]; then
- if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
- if [ "$MVNW_VERBOSE" = true ]; then
- echo " - Compiling MavenWrapperDownloader.java ..."
- fi
- # Compiling the Java class
- ("$JAVA_HOME/bin/javac" "$javaClass")
- fi
- if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then
- # Running the downloader
- if [ "$MVNW_VERBOSE" = true ]; then
- echo " - Running MavenWrapperDownloader.java ..."
- fi
- ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR")
- fi
- fi
- fi
-fi
-##########################################################################################
-# End of extension
-##########################################################################################
-
-export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"}
-if [ "$MVNW_VERBOSE" = true ]; then
- echo $MAVEN_PROJECTBASEDIR
-fi
-MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS"
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin; then
- [ -n "$M2_HOME" ] &&
- M2_HOME=`cygpath --path --windows "$M2_HOME"`
- [ -n "$JAVA_HOME" ] &&
- JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"`
- [ -n "$CLASSPATH" ] &&
- CLASSPATH=`cygpath --path --windows "$CLASSPATH"`
- [ -n "$MAVEN_PROJECTBASEDIR" ] &&
- MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"`
-fi
-
-# Provide a "standardized" way to retrieve the CLI args that will
-# work with both Windows and non-Windows executions.
-MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@"
-export MAVEN_CMD_LINE_ARGS
-
-WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
-
-exec "$JAVACMD" \
- $MAVEN_OPTS \
- -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \
- "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
- ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@"
diff --git a/mvnw.cmd b/mvnw.cmd
deleted file mode 100644
index 8611571..0000000
--- a/mvnw.cmd
+++ /dev/null
@@ -1,182 +0,0 @@
-@REM ----------------------------------------------------------------------------
-@REM Licensed to the Apache Software Foundation (ASF) under one
-@REM or more contributor license agreements. See the NOTICE file
-@REM distributed with this work for additional information
-@REM regarding copyright ownership. The ASF licenses this file
-@REM to you under the Apache License, Version 2.0 (the
-@REM "License"); you may not use this file except in compliance
-@REM with the License. You may obtain a copy of the License at
-@REM
-@REM http://www.apache.org/licenses/LICENSE-2.0
-@REM
-@REM Unless required by applicable law or agreed to in writing,
-@REM software distributed under the License is distributed on an
-@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@REM KIND, either express or implied. See the License for the
-@REM specific language governing permissions and limitations
-@REM under the License.
-@REM ----------------------------------------------------------------------------
-
-@REM ----------------------------------------------------------------------------
-@REM Maven Start Up Batch script
-@REM
-@REM Required ENV vars:
-@REM JAVA_HOME - location of a JDK home dir
-@REM
-@REM Optional ENV vars
-@REM M2_HOME - location of maven2's installed home dir
-@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands
-@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending
-@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven
-@REM e.g. to debug Maven itself, use
-@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000
-@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files
-@REM ----------------------------------------------------------------------------
-
-@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on'
-@echo off
-@REM set title of command window
-title %0
-@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on'
-@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO%
-
-@REM set %HOME% to equivalent of $HOME
-if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%")
-
-@REM Execute a user defined script before this one
-if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre
-@REM check for pre script, once with legacy .bat ending and once with .cmd ending
-if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat"
-if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd"
-:skipRcPre
-
-@setlocal
-
-set ERROR_CODE=0
-
-@REM To isolate internal variables from possible post scripts, we use another setlocal
-@setlocal
-
-@REM ==== START VALIDATION ====
-if not "%JAVA_HOME%" == "" goto OkJHome
-
-echo.
-echo Error: JAVA_HOME not found in your environment. >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo.
-goto error
-
-:OkJHome
-if exist "%JAVA_HOME%\bin\java.exe" goto init
-
-echo.
-echo Error: JAVA_HOME is set to an invalid directory. >&2
-echo JAVA_HOME = "%JAVA_HOME%" >&2
-echo Please set the JAVA_HOME variable in your environment to match the >&2
-echo location of your Java installation. >&2
-echo.
-goto error
-
-@REM ==== END VALIDATION ====
-
-:init
-
-@REM Find the project base dir, i.e. the directory that contains the folder ".mvn".
-@REM Fallback to current working directory if not found.
-
-set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR%
-IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir
-
-set EXEC_DIR=%CD%
-set WDIR=%EXEC_DIR%
-:findBaseDir
-IF EXIST "%WDIR%"\.mvn goto baseDirFound
-cd ..
-IF "%WDIR%"=="%CD%" goto baseDirNotFound
-set WDIR=%CD%
-goto findBaseDir
-
-:baseDirFound
-set MAVEN_PROJECTBASEDIR=%WDIR%
-cd "%EXEC_DIR%"
-goto endDetectBaseDir
-
-:baseDirNotFound
-set MAVEN_PROJECTBASEDIR=%EXEC_DIR%
-cd "%EXEC_DIR%"
-
-:endDetectBaseDir
-
-IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig
-
-@setlocal EnableExtensions EnableDelayedExpansion
-for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a
-@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS%
-
-:endReadAdditionalConfig
-
-SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe"
-set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar"
-set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain
-
-set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
-
-FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
- IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
-)
-
-@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
-@REM This allows using the maven wrapper in projects that prohibit checking in binary data.
-if exist %WRAPPER_JAR% (
- if "%MVNW_VERBOSE%" == "true" (
- echo Found %WRAPPER_JAR%
- )
-) else (
- if not "%MVNW_REPOURL%" == "" (
- SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar"
- )
- if "%MVNW_VERBOSE%" == "true" (
- echo Couldn't find %WRAPPER_JAR%, downloading it ...
- echo Downloading from: %DOWNLOAD_URL%
- )
-
- powershell -Command "&{"^
- "$webclient = new-object System.Net.WebClient;"^
- "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
- "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
- "}"^
- "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
- "}"
- if "%MVNW_VERBOSE%" == "true" (
- echo Finished downloading %WRAPPER_JAR%
- )
-)
-@REM End of extension
-
-@REM Provide a "standardized" way to retrieve the CLI args that will
-@REM work with both Windows and non-Windows executions.
-set MAVEN_CMD_LINE_ARGS=%*
-
-%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
-if ERRORLEVEL 1 goto error
-goto end
-
-:error
-set ERROR_CODE=1
-
-:end
-@endlocal & set ERROR_CODE=%ERROR_CODE%
-
-if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
-@REM check for post script, once with legacy .bat ending and once with .cmd ending
-if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
-if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
-:skipRcPost
-
-@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
-if "%MAVEN_BATCH_PAUSE%" == "on" pause
-
-if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
-
-exit /B %ERROR_CODE%
diff --git a/pom.xml b/pom.xml
deleted file mode 100644
index c3dc35a..0000000
--- a/pom.xml
+++ /dev/null
@@ -1,208 +0,0 @@
-
-
-
- 4.0.0
-
-
- org.sonatype.oss
- oss-parent
- 7
-
-
- com.squareup.moshi
- moshi-parent
- 1.11.0-SNAPSHOT
- pom
- Moshi (Parent)
- A modern JSON API for Android and Java
- https://github.com/square/moshi
-
-
- moshi
- examples
- adapters
- kotlin/codegen
- kotlin/reflect
- kotlin/tests
-
-
-
- UTF-8
- 1.7
-
-
- 1.0-rc5
- 0.9.17
- 0.2
- 1.16.0
- 2.1.0
- 1.4.0
- 1.5.0
- 7.1
- 0.1.0
- 3.1.0
-
-
- 3.11.1
- 0.15
- 4.12
- 1.2.5
- 1.0
-
-
-
- https://github.com/square/moshi/
- scm:git:https://github.com/square/moshi.git
- scm:git:git@github.com:square/moshi.git
- HEAD
-
-
-
- GitHub Issues
- https://github.com/square/moshi/issues
-
-
-
-
- Apache 2.0
- http://www.apache.org/licenses/LICENSE-2.0.txt
-
-
-
-
-
-
- com.google.code.findbugs
- jsr305
- 3.0.2
- provided
-
-
- junit
- junit
- ${junit.version}
-
-
- com.squareup.okio
- okio
- ${okio.version}
-
-
- org.assertj
- assertj-core
- ${assertj.version}
-
-
- org.jetbrains.kotlin
- kotlin-stdlib
- ${kotlin.version}
-
-
- org.jetbrains.kotlin
- kotlin-reflect
- ${kotlin.version}
-
-
- org.jetbrains.kotlin
- kotlin-test
- ${kotlin.version}
- test
-
-
- org.jetbrains.kotlin
- kotlin-compiler-embeddable
- ${kotlin.version}
-
-
- org.jetbrains.kotlin
- kotlin-annotation-processing-embeddable
- ${kotlin.version}
-
-
- com.google.testing.compile
- compile-testing
- ${compile-testing.version}
-
-
-
-
-
-
- jcenter
- JCenter
- https://jcenter.bintray.com/
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.8.1
-
- javac-with-errorprone
- true
- ${java.version}
- ${java.version}
-
-
-
- org.codehaus.plexus
- plexus-compiler-javac-errorprone
- 2.8
-
-
- com.google.errorprone
- error_prone_core
- 2.3.1
-
-
-
-
- org.jetbrains.kotlin
- kotlin-maven-plugin
- ${kotlin.version}
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-checkstyle-plugin
- 2.17
-
-
- com.puppycrawl.tools
- checkstyle
- 7.7
-
-
-
- true
- checkstyle.xml
- true
- **/Iso8601Utils.java
-
-
-
- verify
-
- checkstyle
-
-
-
-
-
- org.apache.maven.plugins
- maven-release-plugin
- 2.5
-
- true
-
-
-
-
-
diff --git a/settings.gradle.kts b/settings.gradle.kts
new file mode 100644
index 0000000..d595815
--- /dev/null
+++ b/settings.gradle.kts
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2020 Square, Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * https://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+pluginManagement {
+ repositories {
+ mavenCentral()
+ gradlePluginPortal()
+ @Suppress("UnstableApiUsage")
+ exclusiveContent {
+ forRepository {
+ maven {
+ name = "JCenter"
+ setUrl("https://jcenter.bintray.com/")
+ }
+ }
+ filter {
+ includeModule("org.jetbrains.dokka", "dokka-fatjar")
+ }
+ }
+ }
+}
+
+rootProject.name = "moshi-root"
+include(":moshi")
+include(":adapters")
+include(":examples")
+include(":kotlin:reflect")
+include(":kotlin:codegen")
+include(":kotlin:tests")
\ No newline at end of file