changeset 10904:b9915cc91652 jdk-11+10

8200300: better gradle error message Reviewed-by: kcr, arapte Contributed-by: abhinay.agarwal@gluonhq.com
author jvos
date Sat, 14 Apr 2018 11:00:58 +0200
parents 345376202d2b
children 57bfd4bea083 1bb20f9ff029 3dd564a7d1cd
files buildSrc/linux.gradle
diffstat 1 files changed, 30 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/buildSrc/linux.gradle	Fri Apr 13 15:43:59 2018 -0700
+++ b/buildSrc/linux.gradle	Sat Apr 14 11:00:58 2018 +0200
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2013, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -85,8 +85,14 @@
         propFile << "libsGTK2=" << results3.toString().trim()  << "\n";
     },
     { properties ->
-        gtk2CCFlags.addAll(properties.getProperty("cflagsGTK2").split(" "))
-        gtk2LinkFlags.addAll(properties.getProperty("libsGTK2").split(" "))
+        def cflagsGTK2 = properties.getProperty("cflagsGTK2")
+        def libsGTK2 = properties.getProperty("libsGTK2")
+        if (cflagsGTK2 && libsGTK2) {
+            gtk2CCFlags.addAll(cflagsGTK2.split(" "))
+            gtk2LinkFlags.addAll(libsGTK2.split(" "))
+        } else {
+            throw new IllegalStateException("GTK2 development packages not found. If GTK2 packages are installed, please remove the build directory and try again.")
+        }
     }
 )
 
@@ -110,11 +116,11 @@
 
     },
     { properties ->
-        String ccflags =  properties.getProperty("cflagsGTK3")
-        String ldflags =  properties.getProperty("libsGTK3")
-        if (ccflags != null && ! ccflags.equals("")) {
-            gtk3CCFlags.addAll(properties.getProperty("cflagsGTK3").split(" "))
-            gtk3LinkFlags.addAll(properties.getProperty("libsGTK3").split(" "))
+        def ccflags =  properties.getProperty("cflagsGTK3")
+        def ldflags =  properties.getProperty("libsGTK3")
+        if (ccflags && ldflags) {
+            gtk3CCFlags.addAll(ccflags.split(" "))
+            gtk3LinkFlags.addAll(ldflags.split(" "))
         } else {
             logger.info("Warning: GTK3 development packages not found, not building GTK3 support");
             LINUX.buildGTK3 = false
@@ -141,8 +147,14 @@
         propFile << "libs=" << results.toString().trim();
     },
     { properties ->
-        pangoCCFlags.addAll(properties.getProperty("cflags").split(" "))
-        pangoLinkFlags.addAll(properties.getProperty("libs").split(" "))
+        def cflags = properties.getProperty("cflags")
+        def libs = properties.getProperty("libs")
+        if (cflags && libs) {
+            pangoCCFlags.addAll(cflags.split(" "))
+            pangoLinkFlags.addAll(libs.split(" "))
+        } else {
+            throw new IllegalStateException("Linux pango packages not found.\nIf pango packages are installed, please remove the build directory and try again.")
+        }
     }
 )
 
@@ -166,8 +178,14 @@
         propFile << "libs=" << results.toString().trim();
     },
     { properties ->
-        freetypeCCFlags.addAll(properties.getProperty("cflags").split(" "))
-        freetypeLinkFlags.addAll(properties.getProperty("libs").split(" "))
+        def cflags = properties.getProperty("cflags")
+        def libs = properties.getProperty("libs")
+        if (cflags && libs) {
+            freetypeCCFlags.addAll(cflags.split(" "))
+            freetypeLinkFlags.addAll(libs.split(" "))
+        } else {
+            throw new IllegalStateException("Linux freetype packages not found.\nIf freetype pacakges are installed, please remove the build directory and try again.")
+        }
     }
 )