Git Product home page Git Product logo

Comments (9)

aalmiray avatar aalmiray commented on May 27, 2024 1

Google's ossdetector plugin is used by everyone building gRPC projects, with both Maven and Gradle. That's a sizeable chunk.

from openjfx-docs.

aalmiray avatar aalmiray commented on May 27, 2024

A possible solution would be to use https://github.com/google/osdetector-gradle-plugin from Google, which builds on top of https://github.com/trustin/os-maven-plugin.

This plugin resolves linux and windows as expected but uses osx for MacOSX. The JavaFX 11 artifacts expect mac, thus the minimum changes needed for it to work are

buildscript {
    repositories {
        maven { url 'https://plugins.gradle.org/m2/' }
    }

    dependencies {
        classpath 'com.google.gradle:osdetector-gradle-plugin:1.6.0'
    }
}

apply plugin: 'com.google.osdetector'

ext.platform = osdetector.os != 'osx' ? osdetector.os : 'mac'

Or alternatively since Gradle 2.1

plugins {
    id 'com.google.osdetector' version '1.6.0'
}

ext.platform = osdetector.os != 'osx' ? osdetector.os : 'mac'

Also, do not use script variables, prefer the usage of project variables, that is,

def platform = 'mac' // don't !!
project.ext.platform = 'mac' // :-)

from openjfx-docs.

abhinayagarwal avatar abhinayagarwal commented on May 27, 2024

Using a plugin to replace the internal API and the ugly if..else is definitely a +1

from openjfx-docs.

mkroening avatar mkroening commented on May 27, 2024

There is also org.gradle.nativeplatform.platform.OperatingSystem, which is however still incubating.

from openjfx-docs.

mkroening avatar mkroening commented on May 27, 2024

I like it!
Note that for gradle 2.1+ this is sufficient to apply the plugin:

plugins {
  id "com.google.osdetector" version "1.6.0"
}

from openjfx-docs.

tiainen avatar tiainen commented on May 27, 2024

My opinion is that having a dependency to a gradle plugin or a dependency to internal gradle API is the same. They are both pieces that are outside your direct control and that might break things in the future.

Having said that, the plugin dependency is an improvement here, just for the sake of readability. @aalmiray, it would be great if you can create a PR with your suggestions!

from openjfx-docs.

swpalmer avatar swpalmer commented on May 27, 2024

Use of a plugin for such a simple thing (at this stage anyway - with only three flavours to pick) seems like overkill. Specially if you have to massage the strings with additional conditions anyway ('osx' -> 'mac').
The use of the internal API in the first place is strange. The author should have known they were making mistake before they finished typing the line. Forgivable for your own private code perhaps, but when making it a public example - worthy of a few lashes. :-)

from openjfx-docs.

tiainen avatar tiainen commented on May 27, 2024

Fixed by #7.

from openjfx-docs.

abhinayagarwal avatar abhinayagarwal commented on May 27, 2024

Just got my hand on a windows machine. The plugin actually sets the platform as 'windows' instead of 'win'.

A viable solution would be to extend the condition:

ext.platform = osdetector.os == 'osx' ? 'mac' : osdetector.os == 'windows' ? 'win' : osdetector.os

I am writing it here in case someone has a better approach.

from openjfx-docs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.