Skip to content
This repository was archived by the owner on Jun 3, 2025. It is now read-only.

Commit 65a8ce6

Browse files
authored
Merge pull request #19 from bnorm/kotlin-native
Kotlin/Native
2 parents eec846d + cc35a07 commit 65a8ce6

File tree

23 files changed

+147
-57
lines changed

23 files changed

+147
-57
lines changed

gradle/wrapper/gradle-wrapper.jar

508 Bytes
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

gradlew

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ esac
8282

8383
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
8484

85+
8586
# Determine the Java command to use to start the JVM.
8687
if [ -n "$JAVA_HOME" ] ; then
8788
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
@@ -129,6 +130,7 @@ fi
129130
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
130131
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
131132
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133+
132134
JAVACMD=`cygpath --unix "$JAVACMD"`
133135

134136
# We build the pattern for arguments to be converted via cygpath

gradlew.bat

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
4040

4141
set JAVA_EXE=java.exe
4242
%JAVA_EXE% -version >NUL 2>&1
43-
if "%ERRORLEVEL%" == "0" goto init
43+
if "%ERRORLEVEL%" == "0" goto execute
4444

4545
echo.
4646
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -54,7 +54,7 @@ goto fail
5454
set JAVA_HOME=%JAVA_HOME:"=%
5555
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
5656

57-
if exist "%JAVA_EXE%" goto init
57+
if exist "%JAVA_EXE%" goto execute
5858

5959
echo.
6060
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
@@ -64,28 +64,14 @@ echo location of your Java installation.
6464

6565
goto fail
6666

67-
:init
68-
@rem Get command-line arguments, handling Windows variants
69-
70-
if not "%OS%" == "Windows_NT" goto win9xME_args
71-
72-
:win9xME_args
73-
@rem Slurp the command line arguments.
74-
set CMD_LINE_ARGS=
75-
set _SKIP=2
76-
77-
:win9xME_args_slurp
78-
if "x%~1" == "x" goto execute
79-
80-
set CMD_LINE_ARGS=%*
81-
8267
:execute
8368
@rem Setup the command line
8469

8570
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
8671

72+
8773
@rem Execute Gradle
88-
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
74+
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
8975

9076
:end
9177
@rem End local scope for the variables with windows NT shell

kotlin-power-assert-gradle/src/main/kotlin/com/bnorm/power/PowerAssertGradlePlugin.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,13 @@ class PowerAssertGradlePlugin : KotlinCompilerPluginSupportPlugin {
3434

3535
override fun getPluginArtifact(): SubpluginArtifact = SubpluginArtifact(
3636
groupId = "com.bnorm.power",
37-
artifactId = "kotlin-power-assert",
37+
artifactId = "kotlin-power-assert-plugin",
38+
version = "0.5.0-SNAPSHOT"
39+
)
40+
41+
override fun getPluginArtifactForNative(): SubpluginArtifact = SubpluginArtifact(
42+
groupId = "com.bnorm.power",
43+
artifactId = "kotlin-power-assert-plugin-native",
3844
version = "0.5.0-SNAPSHOT"
3945
)
4046

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
src/
Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,120 @@
1+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+
3+
plugins {
4+
kotlin("jvm")
5+
kotlin("kapt")
6+
id("org.jetbrains.dokka")
7+
8+
signing
9+
`maven-publish`
10+
}
11+
12+
dependencies {
13+
compileOnly("org.jetbrains.kotlin:kotlin-compiler")
14+
15+
kapt("com.google.auto.service:auto-service:1.0-rc6")
16+
compileOnly("com.google.auto.service:auto-service-annotations:1.0-rc6")
17+
}
18+
19+
tasks.named("compileKotlin") { dependsOn("syncSource") }
20+
tasks.register<Sync>("syncSource") {
21+
from(project(":kotlin-power-assert-plugin").sourceSets.main.get().allSource)
22+
into("src/main/kotlin")
23+
filter {
24+
// Replace shadowed imports from kotlin-power-assert-plugin
25+
when (it) {
26+
"import org.jetbrains.kotlin.com.intellij.mock.MockProject" -> "import com.intellij.mock.MockProject"
27+
else -> it
28+
}
29+
}
30+
}
31+
32+
tasks.withType<KotlinCompile> {
33+
kotlinOptions.jvmTarget = "1.8"
34+
}
35+
36+
tasks.dokka {
37+
outputFormat = "html"
38+
outputDirectory = "$buildDir/javadoc"
39+
}
40+
41+
tasks.register("sourcesJar", Jar::class) {
42+
group = "build"
43+
description = "Assembles Kotlin sources"
44+
45+
archiveClassifier.set("sources")
46+
from(sourceSets.main.get().allSource)
47+
dependsOn(tasks.classes)
48+
}
49+
50+
tasks.register("dokkaJar", Jar::class) {
51+
group = "documentation"
52+
description = "Assembles Kotlin docs with Dokka"
53+
54+
archiveClassifier.set("javadoc")
55+
from(tasks.dokka)
56+
dependsOn(tasks.dokka)
57+
}
58+
59+
signing {
60+
setRequired(provider { gradle.taskGraph.hasTask("publish") })
61+
sign(publishing.publications)
62+
}
63+
64+
publishing {
65+
publications {
66+
create<MavenPublication>("default") {
67+
from(components["java"])
68+
artifact(tasks["sourcesJar"])
69+
artifact(tasks["dokkaJar"])
70+
71+
pom {
72+
name.set(project.name)
73+
description.set("Kotlin compiler plugin to enable power assertions in the Kotlin programming language")
74+
url.set("https://github.com/bnorm/kotlin-power-assert")
75+
76+
licenses {
77+
license {
78+
name.set("Apache License 2.0")
79+
url.set("https://github.com/bnorm/kotlin-power-assert/blob/master/LICENSE.txt")
80+
}
81+
}
82+
scm {
83+
url.set("https://github.com/bnorm/kotlin-power-assert")
84+
connection.set("scm:git:git://github.com/bnorm/kotlin-power-assert.git")
85+
}
86+
developers {
87+
developer {
88+
name.set("Brian Norman")
89+
url.set("https://github.com/bnorm")
90+
}
91+
}
92+
}
93+
}
94+
}
95+
96+
repositories {
97+
if (
98+
hasProperty("sonatypeUsername") &&
99+
hasProperty("sonatypePassword") &&
100+
hasProperty("sonatypeSnapshotUrl") &&
101+
hasProperty("sonatypeReleaseUrl")
102+
) {
103+
maven {
104+
val url = when {
105+
"SNAPSHOT" in version.toString() -> property("sonatypeSnapshotUrl")
106+
else -> property("sonatypeReleaseUrl")
107+
} as String
108+
setUrl(url)
109+
credentials {
110+
username = property("sonatypeUsername") as String
111+
password = property("sonatypePassword") as String
112+
}
113+
}
114+
}
115+
maven {
116+
name = "test"
117+
setUrl("file://${rootProject.buildDir}/localMaven")
118+
}
119+
}
120+
}

kotlin-power-assert/build.gradle.kts renamed to kotlin-power-assert-plugin/build.gradle.kts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ plugins {
1010
}
1111

1212
dependencies {
13-
implementation(kotlin("stdlib-jdk8"))
1413
compileOnly("org.jetbrains.kotlin:kotlin-compiler-embeddable")
1514

1615
kapt("com.google.auto.service:auto-service:1.0-rc6")
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)