Improved Gradle plugin. Fixed samples according to these changes. (#594)

This commit is contained in:
Alexander Podkhalyuzin
2017-05-26 15:43:16 +03:00
committed by Nikolay Igotti
parent 7d901dc610
commit 8b18c7c8cb
81 changed files with 803 additions and 748 deletions
+9 -4
View File
@@ -2,11 +2,16 @@
This example shows how to communicate with libcurl, HTTP/HTTPS/FTP/etc client library.
Debian-like distros may need to `apt-get install libcurl4-openssl-dev`.
To build use `./build.sh` script without arguments (or specify `TARGET` variable if cross-compiling).
You also may use Gradle to build this sample: `../gradlew build`.
To run use
To build use `../gradlew build`.
./Curl.kexe https://www.jetbrains.com
To run use `../gradlew run`
To change run arguments, change property runArgs in gradle.propeties file
or pass `-PrunArgs="https://www.jetbrains.com"` to gradle run.
Alternatively you can run artifact directly
./build/konan/bin/Curl/Curl.kexe https://www.jetbrains.com
It will perform HTTP get and print out the data obtained.
-18
View File
@@ -2,31 +2,13 @@ apply plugin: 'konan'
konanInterop {
libcurl {
defFile 'libcurl.def'
includeDirs '/usr/include', '/opt/local/include', '/usr/local/opt/curl/include', '.'
}
}
konanArtifacts {
Curl {
inputFiles project.fileTree('src')
useInterop 'libcurl'
linkerOpts "-L/opt/local/lib -L/usr/lib/x86_64-linux-gnu -L/usr/local/opt/curl/lib -lcurl"
}
}
build {
project.ext { outputFile = "${projectDir.canonicalPath}/${file(compileKonanCurl.artifactPath).name}" }
doLast {
copy {
from compileKonanCurl.artifactPath
into projectDir.canonicalPath
}
}
}
clean {
doLast {
delete outputFile
}
}
+13 -3
View File
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
DIR=$(dirname "$0")
PATH=../../dist/bin:../../bin:$PATH
DIR=.
CFLAGS_macbook=-I/opt/local/include
CFLAGS_linux=-I/usr/include/x86_64-linux-gnu
@@ -23,5 +23,15 @@ LINKER_ARGS=${!var}
var=COMPILER_ARGS_${TARGET}
COMPILER_ARGS=${!var} # add -opt for an optimized build.
cinterop -copt "$CFLAGS" -copt -I. -copt -I/usr/include -def $DIR/libcurl.def -target $TARGET -o libcurl.bc || exit 1
konanc -target $TARGET src -library libcurl.bc -linkerArgs "$LINKER_ARGS" -o Curl.kexe || exit 1
rm -rf $DIR/build/
mkdir $DIR/build/
mkdir $DIR/build/c_interop/
mkdir $DIR/build/bin/
cinterop -copt "$CFLAGS" -copt -I$DIR -copt -I/usr/include -def $DIR/src/c_interop/libcurl.def -target $TARGET \
-o $DIR/build/c_interop/libcurl.bc || exit 1
konanc -target $TARGET $DIR/src/kotlin-native -library $DIR/build/c_interop/libcurl.bc -linkerArgs "$LINKER_ARGS" \
-o $DIR/build/bin/Curl.kexe || exit 1
echo "Artifact path is ./build/bin/Curl.kexe"
+1
View File
@@ -0,0 +1 @@
runArgs=https://www.jetbrains.com