gluonfx-maven-plugin
gluonfx-maven-plugin copied to clipboard
Add support for building with Command Line Tools (without full Xcode)
I tried to build default project on macOS and it failed:
[email protected] ~/dev/_mine/java/_tmps/client-samples/Maven/HelloFXML $ mvn clean client:build
Picked up JAVA_TOOL_OPTIONS: -Duser.language=en -Djava.awt.headless=true
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------< hello:hellofxml >---------------------------
[INFO] Building hellofxml 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ hellofxml ---
[INFO] Deleting /Users/wojtek/dev/_mine/java/_tmps/client-samples/Maven/HelloFXML/target
[INFO]
[INFO] --------------------------< hello:hellofxml >---------------------------
[INFO] Building hellofxml 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- client-maven-plugin:0.0.11:build (default-cli) @ hellofxml ---
Picked up JAVA_TOOL_OPTIONS: -Duser.language=en -Djava.awt.headless=true
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------< hello:hellofxml >---------------------------
[INFO] Building hellofxml 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- client-maven-plugin:0.0.11:compile (default-cli) @ hellofxml ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to /Users/wojtek/dev/_mine/java/_tmps/client-samples/Maven/HelloFXML/target/classes
Omega :: host triplet = x86_64-macos-macos
Omega :: target triplet = x86_64-macos-macos
[Wed Aug 14 13:45:37 CLT 2019][FINE] ==================== COMPILE TASK ====================
[Wed Aug 14 13:45:37 CLT 2019][FINE] Compiling additional sources to /Users/wojtek/dev/_mine/java/_tmps/client-samples/Maven/HelloFXML/target/client/macos-x86_64/gvm/hellofxml
[Wed Aug 14 13:45:37 CLT 2019][FINE] Looking for resource: /native/macosx/AppDelegate.m
[Wed Aug 14 13:45:37 CLT 2019][FINE] Looking for resource: /native/macosx/AppDelegate.h
[Wed Aug 14 13:45:37 CLT 2019][FINE] Looking for resource: /native/macosx/launcher.c
java.lang.RuntimeException: Couldn't find a relevant iOS SDK. Please mail [email protected] with the contents of /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
at com.gluonhq.omega.target.DarwinTargetProcess$SdkDirType.getSdkDir(DarwinTargetProcess.java:80)
at com.gluonhq.omega.target.DarwinTargetProcess$SdkDirType.getSDKPath(DarwinTargetProcess.java:70)
at com.gluonhq.omega.target.MacosTargetProcess.compileAdditionalSources(MacosTargetProcess.java:421)
at com.gluonhq.omega.target.AbstractTargetProcess.compile(AbstractTargetProcess.java:317)
at com.gluonhq.omega.Omega.nativeCompile(Omega.java:72)
at com.gluonhq.NativeCompileMojo.execute(NativeCompileMojo.java:77)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:956)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:192)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:567)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
[INFO] ------------------------------------------------------------------------
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.817 s
[INFO] Finished at: 2019-08-14T13:45:37-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.gluonhq:client-maven-plugin:0.0.11:compile (default-cli) on project hellofxml: Error: Couldn't find a relevant iOS SDK. Please mail [email protected] with the contents of /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.868 s
[INFO] Finished at: 2019-08-14T13:45:37-04:00
[INFO] ------------------------------------------------------------------------
[email protected] ~/dev/_mine/java/_tmps/client-samples/Maven/HelloFXML $
I have installed llvm from brew:
[email protected] ~/dev/_mine/java/_tmps/client-samples/Maven/HelloFXML $ llvm-gcc --version
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
and Xcode command line tools (do you require full Xcode? even if someone doesn't want to build for iOS?)
As per error message - as I don't have Xcode I don't have this path, but I have SDK for macOS:
$ ls -lah /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/
total 0
drwxr-xr-x 7 root wheel 224 Jul 23 20:48 .
drwxr-xr-x 4 root wheel 128 Jul 23 20:48 ..
-rw-r--r-- 1 root wheel 127 Feb 22 23:33 Entitlements.plist
-rw-r--r-- 1 root wheel 1.2K Feb 22 23:33 SDKSettings.json
-rw-r--r-- 1 root wheel 1.3K Feb 22 23:33 SDKSettings.plist
drwxr-xr-x 3 root wheel 96 Aug 31 2018 System
drwxr-xr-x 7 root wheel 224 Aug 31 2018 usr
if you don't have this folder:
"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs", the process will fail (actually the message is wrong, it should say "MacOSX", not iOS).
But I see that you can have the SDK in a different path (content looks good), so what we could do is have an option to allow a different path to the SDK, other than the default from Xcode?
I'd say that both locations should be checked as commandline-only is not something that unusual (I used this guide: http://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/) but if that's not on the table the option to specify path + documentation entry how to set it up and why one would need to use it.
A little bit of update - I symlinked the directories and run into another issue:
Omega :: host triplet = x86_64-macos-macos
Omega :: target triplet = x86_64-macos-macos
[Wed Aug 14 16:59:48 CLT 2019][FINE] ==================== COMPILE TASK ====================
[Wed Aug 14 16:59:48 CLT 2019][FINE] Compiling additional sources to /Users/wojtek/dev/_mine/java/_tmps/client-samples/Maven/HelloFXML/target/client/macos-x86_64/gvm/hellofxml
[Wed Aug 14 16:59:48 CLT 2019][FINE] Looking for resource: /native/macosx/AppDelegate.m
[Wed Aug 14 16:59:48 CLT 2019][FINE] Looking for resource: /native/macosx/AppDelegate.h
[Wed Aug 14 16:59:48 CLT 2019][FINE] Looking for resource: /native/macosx/launcher.c
[Wed Aug 14 16:59:48 CLT 2019][FINE] Sdk path: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk, for type MacOSX
[Wed Aug 14 16:59:48 CLT 2019][FINE] proccmds = clang -c -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -DGVM_VERBOSE AppDelegate.m launcher.c
[Wed Aug 14 16:59:48 CLT 2019][INFO] [SUB] xcrun: error: invalid active developer path (/Applications/Xcode.app/Contents/Developer), missing xcrun at: /Applications/Xcode.app/Contents/Developer/usr/bin/xcrun
[Wed Aug 14 16:59:48 CLT 2019][FINE] Result of compile = 1
java.lang.RuntimeException: Error compiling additional sources
However, the binary is available if there is no symlink:
$ whereis xcrun
/usr/bin/xcrun
$ xcrun --version
xcrun version 43.1.
It would be better not to depend on fixed paths to binaries in this case.