How to deliver a desktop app of Kotlin multiplatform project? - kotlin-multiplatform

I don't see in documentations. When I build a multiplatform compose project based on JVM, how can I deliver a desktop package or app so others can execute it easily?
==========
Update:
I specified the following in build.gradle.kts under desktop
compose.desktop {
application {
mainClass = "MainKt"
javaHome = System.getenv("JDK_18")
nativeDistributions {
targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb)
packageName = "MyApp"
packageVersion = "1.0.0"
}
}
}
Then running ./gradlew packageDeb (on Ubuntu) I got a .deb package, which I could install on Ubuntu and run. Very cool. (It looks there is no option building it from Intellij and I have to do it with gradlew)
Then I tried ./gradlew packageMsi, it came back very quickly saying build successful, but I get no .msi file generated. Do I have to build it from a Windows machine?
I haven't tried to build the dmg for Mac as it's advised to use XCode on the Mac to generate a signed version.
==============
Update 1:
So based on description of jPackage from Oracle:
Application packages must be built on the target platform. The system
used for packaging must contain the application, a JDK, and software
needed by the packaging tool.
To package your application for multiple platforms, you must run the
packaging tool on each platform. If you want more than one format for
a platform, you must run the tool once for each format.

Related

Electron - build an installer for Windows x64 on Mac

I am new to electron and trying to build a windows installer for the electron app using my mac. I am using electron-packager to package the app and then electron-wix-msi to build the installer. When the build installer steps are executed, the error Unable to read file info from exe. Falling back to packaging description. Error: spawn Unknown system error -86 is thrown. please see the full error message in the attached screenshot.
I would like to highlight that when I build an installer for macOS, it works. Should I understand that I can not build a windows installer using mac?
build_installer64.ts file:
You can't do that, you have to do this on the Windows platform.
I use GitHub Actions to build my app for each platform, code for Windows:
https://code.korbsstudio.com/KorbsStudio/electron-builder-sample/-/blob/main/.github/workflows/build.yml#L52-71
Optionally, you can also use a Windows virtual machine and repeat the same process in there.
Update, for those interested in doing this on Linux, building a EXE setup file seems to be possible. You'll need to have wine installed and use:
npx electron-builder build --win

How to build a Windows driver development kit 7 on 10

I am trying to build a Windows driver for a piece of hardware I am using. The build notes seem dated as they specify using DDK for Win7. I have Windows kit version 10. Are these the same thing just later version? The instructions then state to open a DDK command window environment then use "build -ceZ" in the dir where the files are located. Does v10 have this console and if so where can I find it? Thanks
https://learn.microsoft.com/en-us/windows-hardware/drivers/devtest/wdk-and-visual-studio-build-environment
"The Windows Driver Kit (WDK) 8.1 and WDK 8 introduced a major change
to the environment that you use to build a driver. The WDK no longer
uses Build.exe. The WDK build environment for drivers uses MSBuild.exe
and is fully integrated with the Visual Studio development
environment. This means that source files, makefile.inc, makefile.new
and other related build files present in the previous version of the
WDK are no longer used. The WDK now enables you to create, edit,
build, test, and deploy a driver through Visual Studio. The purpose of
this document is to provide information to help users familiar with
previous WDKs in getting started with the WDK 8.1 and WDK 8."
If you want to build the driver as is then you will need to install the Windows 7.1 DDK and build it using its tools.
https://en.wikipedia.org/wiki/Windows_Driver_Kit
https://www.microsoft.com/en-gb/download/details.aspx?id=11800
You are allowed to install different versions of the DDK on the same machine.
You might find it tricky to install DDK 7.1 on Windows 10 though, try and use this to get around any problem install.
https://stackoverflow.com/questions/32091593/cannot-install-windows-sdk-7-1-on-windows-10#:~:text=If%20you%20continue%20with%20Setup,187668%20and%20then%20rerun%20Setup.
Then it's just a case of "choosing the 7.1 ddk environment (32bit or 64bit)" so that it's tools are accessible/used when "building" your driver.
Look in your startmenu at "StartMenu -> Windows Driver Kits -> WDK XXXX -> Build Environments" to find a command prompt to open.
If you can't/don't want to install the DDK 7.1 and a WDK8+ version of your driver project isn't available then it may be possible to convert the driver from using the older "makefile" into new msbuild way of building, but might be fiddly.
https://community.osr.com/discussion/289475/build-exe-to-msbuild-exe-migration-advice
"If you go into VS you should be able to create a WDK driver project.
It will give you a solution with (I think) one C file filled with
everything necessary to make a driver which does nothing. But, most
importantly, it will generate an XML file that MSBuild will accept.
The XML format is not documented. After you have this XML file you
should be able to figure out how to add your files to it by hand, but
you could move the existing driver files to the project using the GUI.
That may be easiest."

How to setup android ndk in jenkins on linux

I have jenkins on ubuntu. Building worked fine until I started to use android ndk.
latest ndk is downloaded and extracted into /opt/android-sdk-linux/ndk-bundle
In /etc/profile.d/android.sh is:
export ANDROID_HOME="/opt/android-sdk-linux"
export PATH="$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH"
export ANDROID_NDK_HOME="/opt/android-sdk-linux/ndk-bundle"
but I got still error:
:common:compileDebugNdk FAILED
FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':common:compileDebugNdk'.
NDK not configured.
Download the NDK from http://developer.android.com/tools/sdk/ndk/. Then add ndk.dir=path/to/ndk in local.properties.
(On Windows, make sure you escape backslashes, e.g. C:\ndk rather than C:\ndk)
The message says it all. You should add a text file local.properties to the project directory on the Linux machine, with one line
ndk.dir=/opt/android-sdk-linux/ndk-bundle
This file is usually in .gitignore, and Android Studio generates it automatically. But when you build your project in Jenkins, it does not open Android Studio.

mdtool creates IPA file when using release but not when using debug configuration

I want to create an IPA file for both the release and debug for my app created in xamarin. I created the release IPA file with the following command in Bamboo:
-v build -t:Build "-c:Release|iPhone" CustomerApp.sln
This can be replicated on the terminal too by doing this:
/path-to-/mdtool -v build -t:Build "-c:Release|iPhone" CustomerApp.sln
But when I try to use the "-c:Debug|iPhone" this will not create the ipa file, when trying to use the terminal or Bamboo. I then tried different configurations like "-c:Release|iPhoneSimulator", "-c:Debug|iPhoneSimulator", "-c:Ad Hoc|iPhone" and "-c:Debug|iPhoneSimulator" but all of these will not create the IPA file. Why is this?
I know that the path to mdtool and the solution are fine because it works for the Release IPA but is it to do with the configuration in either Xamarin or Xcode?
If you are on the same Mac as the one you are running Xamarin Studio, it should mimic the provisioning profile setup you have in the IDE. If the build in Xamarin Studio builds with that combination with no drop down change on the main project, I would expect the mdtool to work. Note that now in Visual Studio 2017 for Mac it will be vstool under the /Applications/Visual Studio.app folder.
My build line looks like this:
/Applications/Visual\ Studio.app/Contents/MacOS/vstool --verbose build --f --target:Build --configuration:"Debug|iPhone" --buildfile:my.sln > $BuildResults
Update January 2019, I have found very little guidance on the web about what exactly vstool can do and how to use it. I believe it to be the Microsoft version of the mdtool, which is part of the Monodevelop project at Github (mono/monodevelop). The mdtool source code is under monodevelop/main/src/tools folder. It appears to be a runner for a variety of tools available in the Monodevelop / Visual Studio installation. Running
/Applications/Visual\ Studio.app/Contents/MacOS/vstool -q
will list out the available tools. There is also a man page as part of the Monodevelop build process, at monodevelop/main/man which provides a bit more enlightenment. I was shown how to use the specific command by someone who was very familiar with the project.

location of android or android.bat

I installed cygwin, ant, android ndk and android sdk. I am following the instructions in slyvain's book "android ndk". I am trying to do the following step:
Create Ant build file and all related configuration files automatically using android
command (android.bat on Windows). These files describe how to compile and
package an Android application:
android update project –p .
I get a message that android: command not found.
not sure why this wasn't installed or, not in the path.
any suggestions?
It's in the $ANDROID_SDK_HOME\tools.
$ANDROID_SDK_HOME is the directory where you've installed Android SDK.
Also, remember to run SDK Manager first to fetch at least one Android build target.

Resources