-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Basic setup * Ignore failing test * Gradle 5.0 * Better native config * Fix jvm tests * JS testing setup * Native config * Use EAP dependencies * Japicmp setup * Correct path to japicmp report * Basic JVM + AnimalSniffer setup * Enable samples module * Use jvmWithJava for running Java tests * Include more Native platforms to force test task generation * Use internal UTF-8 decoder for Kotlin/Native * Kotlin 1.3.20 * Gradle 5.1 * Move JMH setup into a separate module * Properly configure jmhJar task * Remove old jvm build.gradle * Replace publishing plugin with SQLDelight's custom script * Use default artifactId for JVM target * Revert JVM build.gradle rename, use new DSL for defining targets * Remove old module definitions in settings * Feedback fixes
- Loading branch information
1 parent
d1bc009
commit 0078fca
Showing
35 changed files
with
450 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
apply plugin: 'maven-publish' | ||
apply plugin: 'signing' | ||
apply plugin: 'org.jetbrains.dokka' | ||
|
||
dokka { | ||
impliedPlatforms = ["Common"] // This will force platform tags for all non-common sources e.g. "JVM" | ||
kotlinTasks { | ||
// dokka fails to retrieve sources from MPP-tasks so they must be set empty to avoid exception | ||
// use sourceRoot instead (see below) | ||
[] | ||
} | ||
packageOptions { | ||
prefix = "com.squareup.okio" | ||
suppress = true | ||
} | ||
sourceRoot { | ||
// assuming there is only a single source dir... | ||
path = kotlin.sourceSets.commonMain.kotlin.srcDirs[0] | ||
platforms = ["Common"] | ||
} | ||
if (kotlin.sourceSets.getNames().contains("jvmMain")) { | ||
sourceRoot { | ||
// assuming there is only a single source dir... | ||
path = kotlin.sourceSets.jvmMain.kotlin.srcDirs[0] | ||
platforms = ["JVM"] | ||
} | ||
} | ||
if (kotlin.sourceSets.getNames().contains("jsMain")) { | ||
sourceRoot { | ||
// assuming there is only a single source dir... | ||
path = kotlin.sourceSets.jsMain.kotlin.srcDirs[0] | ||
platforms = ["js"] | ||
} | ||
} | ||
if (kotlin.sourceSets.getNames().contains("nativeMain")) { | ||
sourceRoot { | ||
// assuming there is only a single source dir... | ||
path = kotlin.sourceSets.nativeMain.kotlin.srcDirs[0] | ||
platforms = ["native"] | ||
} | ||
} | ||
} | ||
|
||
def isReleaseBuild() { | ||
return VERSION_NAME.contains("SNAPSHOT") == false | ||
} | ||
|
||
def getReleaseRepositoryUrl() { | ||
return hasProperty('RELEASE_REPOSITORY_URL') ? RELEASE_REPOSITORY_URL : | ||
"https://oss.sonatype.org/service/local/staging/deploy/maven2/" | ||
} | ||
|
||
def getSnapshotRepositoryUrl() { | ||
return hasProperty('SNAPSHOT_REPOSITORY_URL') ? SNAPSHOT_REPOSITORY_URL : | ||
"https://oss.sonatype.org/content/repositories/snapshots/" | ||
} | ||
|
||
def getRepositoryUsername() { | ||
return hasProperty('SONATYPE_NEXUS_USERNAME') ? SONATYPE_NEXUS_USERNAME : "" | ||
} | ||
|
||
def getRepositoryPassword() { | ||
return hasProperty('SONATYPE_NEXUS_PASSWORD') ? SONATYPE_NEXUS_PASSWORD : "" | ||
} | ||
|
||
task emptySourcesJar(type: Jar) { | ||
classifier = 'sources' | ||
} | ||
|
||
task javadocsJar(type: Jar, dependsOn: dokka) { | ||
classifier = 'javadoc' | ||
from dokka.outputDirectory | ||
} | ||
|
||
signing { | ||
required { isReleaseBuild() && gradle.taskGraph.hasTask("uploadArchives") } | ||
sign(publishing.publications) | ||
} | ||
|
||
publishing { | ||
publications.all { | ||
artifact javadocsJar | ||
|
||
pom.withXml { | ||
def root = asNode() | ||
|
||
root.children().last() + { | ||
resolveStrategy = Closure.DELEGATE_FIRST | ||
|
||
description POM_DESCRIPTION | ||
name POM_NAME | ||
url POM_URL | ||
licenses { | ||
license { | ||
name POM_LICENCE_NAME | ||
url POM_LICENCE_URL | ||
distribution POM_LICENCE_DIST | ||
} | ||
} | ||
scm { | ||
url POM_SCM_URL | ||
connection POM_SCM_CONNECTION | ||
developerConnection POM_SCM_DEV_CONNECTION | ||
} | ||
developers { | ||
developer { | ||
id POM_DEVELOPER_ID | ||
name POM_DEVELOPER_NAME | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
// Use default artifact name for the JVM target until we start publishing artifacts for all | ||
// platforms | ||
publications { | ||
jvm { | ||
artifactId = 'okio' | ||
} | ||
} | ||
|
||
afterEvaluate { | ||
publications.getByName('kotlinMultiplatform') { | ||
// Source jars are only created for platforms, not the common artifact. | ||
artifact emptySourcesJar | ||
} | ||
} | ||
|
||
repositories { | ||
maven { | ||
url isReleaseBuild() ? getReleaseRepositoryUrl() : getSnapshotRepositoryUrl() | ||
credentials { | ||
username getRepositoryUsername() | ||
password getRepositoryPassword() | ||
} | ||
} | ||
maven { | ||
name 'test' | ||
url "file://${rootProject.buildDir}/localMaven" | ||
} | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.1-all.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,85 @@ | ||
apply plugin: 'org.jetbrains.kotlin.platform.common' | ||
apply plugin: 'org.jetbrains.kotlin.multiplatform' | ||
|
||
dependencies { | ||
implementation deps.kotlin.stdLib.common | ||
testImplementation deps.kotlin.test.common | ||
testImplementation deps.kotlin.test.annotations | ||
kotlin { | ||
targets { | ||
// egor: jvmWithJava is getting deprecated but it's not clear what the replacement is. For now | ||
// gonna keep it inside targets {} | ||
fromPreset(presets.jvmWithJava, 'jvm') { | ||
project.sourceSets.test.java.srcDir('jvm/src/test/java') | ||
} | ||
} | ||
js() { | ||
configure([compilations.main, compilations.test]) { | ||
tasks.getByName(compileKotlinTaskName).kotlinOptions { | ||
moduleKind = "commonjs" | ||
} | ||
} | ||
} | ||
iosX64() { | ||
compilations.main.outputKinds 'framework' | ||
} | ||
iosArm64() { | ||
compilations.main.outputKinds 'framework' | ||
} | ||
// Required to generate tests tasks: https://youtrack.jetbrains.com/issue/KT-26547 | ||
linuxX64() | ||
macosX64() | ||
mingwX64('winX64') | ||
sourceSets { | ||
commonMain { | ||
kotlin.srcDir('src/main/kotlin') | ||
dependencies { | ||
implementation deps.kotlin.stdLib.common | ||
} | ||
} | ||
commonTest { | ||
kotlin.srcDir('src/test/kotlin') | ||
dependencies { | ||
implementation deps.kotlin.test.common | ||
implementation deps.kotlin.test.annotations | ||
} | ||
} | ||
jvmMain { | ||
kotlin.srcDir('jvm/src/main/java') | ||
resources.srcDir('jvm/src/main/resources') | ||
dependencies { | ||
implementation deps.kotlin.stdLib.jdk6 | ||
compileOnly deps.animalSniffer.annotations | ||
} | ||
} | ||
jvmTest { | ||
kotlin.srcDir('jvm/src/test/java') | ||
dependencies { | ||
implementation deps.test.junit | ||
implementation deps.test.assertj | ||
implementation deps.kotlin.test.jdk | ||
} | ||
} | ||
jsMain { | ||
kotlin.srcDir('js/src/main/kotlin') | ||
dependencies { | ||
implementation deps.kotlin.stdLib.js | ||
} | ||
} | ||
jsTest { | ||
kotlin.srcDir('js/src/test/kotlin') | ||
dependencies { | ||
implementation deps.kotlin.test.js | ||
} | ||
} | ||
nativeMain { | ||
kotlin.srcDir('native/src/main/kotlin') | ||
} | ||
nativeTest { | ||
kotlin.srcDir('native/src/test/kotlin') | ||
} | ||
} | ||
configure([targets.iosX64, targets.iosArm64, targets.linuxX64, targets.macosX64, targets.winX64]) { | ||
compilations.main.source(sourceSets.nativeMain) | ||
compilations.test.source(sourceSets.nativeTest) | ||
} | ||
} | ||
|
||
apply from: 'js/build.gradle' | ||
apply from: 'jvm/jvm.gradle' | ||
apply from: "$rootDir/gradle/gradle-mvn-mpp-push.gradle" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
POM_ARTIFACT_ID=okio | ||
POM_NAME=Okio | ||
POM_PACKAGING=jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.