Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed build on Windows. Refactored Gradle scripts. #621

Closed
wants to merge 11 commits into from
Prev Previous commit
Next Next commit
Added linuxArm64 target. Refactored Gradle scripts. Removed IgnoreJS.
  • Loading branch information
VDovidaytis-HORIS committed Oct 28, 2022
commit 572619f0960f42582c2d2a645c6c69b2eedeaaeb
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,6 @@ kotlin-js-store
# intermediate build files on Windows
python-package/kotlin-bridge/*.def
python-package/kotlin-bridge/lets_plot_kotlin_bridge.o

# VSCode service directiry
.vscode
19 changes: 0 additions & 19 deletions base-portable/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/

import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform

plugins {
id "org.jetbrains.kotlin.multiplatform"
id "org.jetbrains.gradle.plugin.idea-ext"
Expand All @@ -17,23 +15,6 @@ kotlin {
browser()
}

if (project.buildSettings.build_python_extension) {
def currentOs = DefaultNativePlatform.getCurrentOperatingSystem()

if (currentOs.isMacOsX()) {
def currentArch = DefaultNativePlatform.getCurrentArchitecture()
if (currentArch.displayName.contains("arm-v8")) {
macosArm64()
} else {
macosX64()
}
} else if (currentOs.isLinux()) {
linuxX64()
} else if (currentOs.isWindows()) {
mingwX64()
}
}

sourceSets {
commonMain {
dependencies {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright (c) 2020. JetBrains s.r.o.
* Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/

package jetbrains.datalore.base.logging

import kotlin.reflect.KClass

actual object PortableLogging {
actual fun logger(cl: KClass<*>): Logger {
return PrintlnLogger(cl.simpleName ?: "<anonymous>")
}
}
35 changes: 35 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ plugins {
id "io.codearte.nexus-staging"
}

import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform

project.ext.letsPlotTaskGroup = 'lets-plot'

def include_sources_letsPlotJvmCommon = [
Expand Down Expand Up @@ -177,7 +179,40 @@ task publishKotlinApiDependenciesToMavenRepository {
group project.letsPlotTaskGroup
}


subprojects {
// Configure Kotlin Native build.
if (name in [
'base-portable',
'plot-base-portable',
'plot-builder-portable',
'plot-common-portable',
'plot-config-portable',
'test-common',
'vis-svg-portable',
]) {
apply plugin: "org.jetbrains.kotlin.multiplatform"

def currentOs = DefaultNativePlatform.getCurrentOperatingSystem()
def currentOsArch = DefaultNativePlatform.getCurrentArchitecture()

kotlin{
if (project.buildSettings.build_python_extension) {
if (currentOs.macOsX & currentOsArch.amd64) {
macosX64()
} else if (currentOs.macOsX & currentOsArch.arm) {
macosArm64()
} else if (currentOs.linux & currentOsArch.amd64) {
linuxX64()
} else if (currentOs.linux & currentOsArch.arm) {
linuxArm64()
} else if (currentOs.isWindows()) {
mingwX64()
}
}
}
}

// Configure publishing for projects which "Lets-Plot Kotlin API" depends on.
if (name in [
'plot-base-portable',
Expand Down
19 changes: 0 additions & 19 deletions plot-base-portable/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/

import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform

plugins {
id "org.jetbrains.kotlin.multiplatform"
id "org.jetbrains.gradle.plugin.idea-ext"
Expand All @@ -16,23 +14,6 @@ kotlin {
browser()
}

if (project.buildSettings.build_python_extension) {
def currentOs = DefaultNativePlatform.getCurrentOperatingSystem()

if (currentOs.isMacOsX()) {
def currentArch = DefaultNativePlatform.getCurrentArchitecture()
if (currentArch.displayName.contains("arm-v8")) {
macosArm64()
} else {
macosX64()
}
} else if (currentOs.isLinux()) {
linuxX64()
} else if (currentOs.isWindows()) {
mingwX64()
}
}

sourceSets {
commonMain {
dependencies {
Expand Down
22 changes: 4 additions & 18 deletions plot-builder-portable/build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
/*
* Copyright (c) 2019. JetBrains s.r.o.
* Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/

plugins {
id "org.jetbrains.kotlin.multiplatform"
Expand All @@ -11,23 +14,6 @@ kotlin {
browser()
}

if (project.buildSettings.build_python_extension) {
def currentOs = DefaultNativePlatform.getCurrentOperatingSystem()

if (currentOs.isMacOsX()) {
def currentArch = DefaultNativePlatform.getCurrentArchitecture()
if (currentArch.displayName.contains("arm-v8")) {
macosArm64()
} else {
macosX64()
}
} else if (currentOs.isLinux()) {
linuxX64()
} else if (currentOs.isWindows()) {
mingwX64()
}
}

sourceSets {
commonMain {
dependencies {
Expand Down
19 changes: 0 additions & 19 deletions plot-common-portable/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/

import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform

plugins {
id "org.jetbrains.kotlin.multiplatform"
id "org.jetbrains.gradle.plugin.idea-ext"
Expand All @@ -16,23 +14,6 @@ kotlin {
browser()
}

if (project.buildSettings.build_python_extension) {
def currentOs = DefaultNativePlatform.getCurrentOperatingSystem()

if (currentOs.isMacOsX()) {
def currentArch = DefaultNativePlatform.getCurrentArchitecture()
if (currentArch.displayName.contains("arm-v8")) {
macosArm64()
} else {
macosX64()
}
} else if (currentOs.isLinux()) {
linuxX64()
} else if (currentOs.isWindows()) {
mingwX64()
}
}

sourceSets {
commonMain {
dependencies {
Expand Down
19 changes: 0 additions & 19 deletions plot-config-portable/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/

import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform

plugins {
id "org.jetbrains.kotlin.multiplatform"
id "org.jetbrains.gradle.plugin.idea-ext"
Expand All @@ -16,23 +14,6 @@ kotlin {
browser()
}

if (project.buildSettings.build_python_extension) {
def currentOs = DefaultNativePlatform.getCurrentOperatingSystem()

if (currentOs.isMacOsX()) {
def currentArch = DefaultNativePlatform.getCurrentArchitecture()
if (currentArch.displayName.contains("arm-v8")) {
macosArm64()
} else {
macosX64()
}
} else if (currentOs.isLinux()) {
linuxX64()
} else if (currentOs.isWindows()) {
mingwX64()
}
}

sourceSets {
commonMain {
dependencies {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

package jetbrains.datalore.plot

import jetbrains.datalore.base.annotation.IgnoreJs
import jetbrains.datalore.base.geometry.DoubleVector
import jetbrains.datalore.plot.testing.EXPECTED_BUNCH_SVG
import jetbrains.datalore.plot.testing.EXPECTED_SINGLE_PLOT_SVG
Expand All @@ -14,14 +13,12 @@ import kotlin.test.assertEquals

internal class PlotSvgHelperTest {
@Test
@IgnoreJs
fun svgSizeFromSinglePlotSvg() {
val sizeFromSvg = PlotSvgHelper.fetchPlotSizeFromSvg(EXPECTED_SINGLE_PLOT_SVG)
assertEquals(DoubleVector(400.0, 300.0), sizeFromSvg)
}

@Test
@IgnoreJs
fun svgSizeFromGGBunchSvg() {
val sizeFromSvg = PlotSvgHelper.fetchPlotSizeFromSvg(EXPECTED_BUNCH_SVG)
assertEquals(DoubleVector(300.0, 150.0), sizeFromSvg)
Expand Down
4 changes: 3 additions & 1 deletion python-package-build/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ plugins {
// ----------------------------------------

def currentOs = DefaultNativePlatform.getCurrentOperatingSystem()
def currentOsArch = DefaultNativePlatform.getCurrentArchitecture()

//def task_group = 'lets plot'
def tools_dir = "${rootDir}/tools"
def python_package_dir = "${rootDir}/python-package"
Expand Down Expand Up @@ -59,7 +61,7 @@ if (project.buildSettings.enable_python_package) {
description = 'Builds lets-plot wheel distribution with Manylinux platform for publication(python)'

workingDir tools_dir
commandLine "./run_manylinux_docker.sh", "${rootDir}"
commandLine "./run_manylinux_docker.sh", "${rootDir}", "${currentOsArch}"
}


Expand Down
19 changes: 0 additions & 19 deletions test-common/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
* Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/

import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform

plugins {
id "org.jetbrains.kotlin.multiplatform"
id "org.jetbrains.gradle.plugin.idea-ext"
Expand All @@ -16,23 +14,6 @@ kotlin {
browser()
}

if (project.buildSettings.build_python_extension) {
def currentOs = DefaultNativePlatform.getCurrentOperatingSystem()

if (currentOs.isMacOsX()) {
def currentArch = DefaultNativePlatform.getCurrentArchitecture()
if (currentArch.displayName.contains("arm-v8")) {
macosArm64("native")
} else {
macosX64("native")
}
} else if (currentOs.isLinux()) {
linuxX64("native")
} else if (currentOs.isWindows()) {
mingwX64("native")
}
}

sourceSets {
commonMain {
dependencies {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading