From f30c840d1c7cd83e47a2c46d56f5681fb2a9c8b8 Mon Sep 17 00:00:00 2001 From: Svyatoslav Scherbina Date: Thu, 13 Oct 2016 17:19:19 +0300 Subject: [PATCH] runtime: move hash functions to newly created subproject to reuse in compiler --- common/build.gradle | 16 ++++++++++++++++ .../src/main => common/src/hash}/cpp/City.cpp | 0 .../src/main => common/src/hash}/cpp/Sha1.cpp | 0 .../main/cpp => common/src/hash/headers}/City.h | 0 .../main/cpp => common/src/hash/headers}/Sha1.h | 0 runtime/build.gradle | 3 +++ settings.gradle | 1 + 7 files changed, 20 insertions(+) create mode 100644 common/build.gradle rename {runtime/src/main => common/src/hash}/cpp/City.cpp (100%) rename {runtime/src/main => common/src/hash}/cpp/Sha1.cpp (100%) rename {runtime/src/main/cpp => common/src/hash/headers}/City.h (100%) rename {runtime/src/main/cpp => common/src/hash/headers}/Sha1.h (100%) diff --git a/common/build.gradle b/common/build.gradle new file mode 100644 index 00000000000..09d78a6f1c1 --- /dev/null +++ b/common/build.gradle @@ -0,0 +1,16 @@ +import org.jetbrains.kotlin.CompileCppToBitcode + +// TODO: consider using some Gradle plugins to build and test + + +task compileHash(type: CompileCppToBitcode) { + name 'hash' +} + +task build { + dependsOn compileHash +} + +task clean << { + delete buildDir +} diff --git a/runtime/src/main/cpp/City.cpp b/common/src/hash/cpp/City.cpp similarity index 100% rename from runtime/src/main/cpp/City.cpp rename to common/src/hash/cpp/City.cpp diff --git a/runtime/src/main/cpp/Sha1.cpp b/common/src/hash/cpp/Sha1.cpp similarity index 100% rename from runtime/src/main/cpp/Sha1.cpp rename to common/src/hash/cpp/Sha1.cpp diff --git a/runtime/src/main/cpp/City.h b/common/src/hash/headers/City.h similarity index 100% rename from runtime/src/main/cpp/City.h rename to common/src/hash/headers/City.h diff --git a/runtime/src/main/cpp/Sha1.h b/common/src/hash/headers/Sha1.h similarity index 100% rename from runtime/src/main/cpp/Sha1.h rename to common/src/hash/headers/Sha1.h diff --git a/runtime/build.gradle b/runtime/build.gradle index 2923fa46d46..1cb729defdc 100644 --- a/runtime/build.gradle +++ b/runtime/build.gradle @@ -7,6 +7,9 @@ task build(type: CompileCppToBitcode) { name 'runtime' srcRoot file('src/main') + dependsOn ':common:compileHash' + compilerArgs '-I' + project.file('../common/src/hash/headers') // TODO: copy-pasted from 'common' + linkerArgs project.file('../common/build/hash.bc').path } task test { diff --git a/settings.gradle b/settings.gradle index fbd1ea6cbcd..04fc18c90ee 100644 --- a/settings.gradle +++ b/settings.gradle @@ -4,3 +4,4 @@ include ':Interop:Runtime' include ':InteropExample' include ':backend.native' include ':runtime' +include ':common'