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

This reverts commit 8b18c7c8cb.
This commit is contained in:
igotti-google
2017-05-27 11:27:00 +03:00
parent 9760e0f21c
commit fe3ae96079
81 changed files with 748 additions and 803 deletions
+4 -9
View File
@@ -2,16 +2,11 @@
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 build use `../gradlew build`.
To run use
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
./Curl.kexe https://www.jetbrains.com
It will perform HTTP get and print out the data obtained.
+18
View File
@@ -2,13 +2,31 @@ 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
}
}
+3 -13
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,15 +23,5 @@ LINKER_ARGS=${!var}
var=COMPILER_ARGS_${TARGET}
COMPILER_ARGS=${!var} # add -opt for an optimized build.
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"
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
-1
View File
@@ -1 +0,0 @@
runArgs=https://www.jetbrains.com