-
You have to update Kotlin library location in file
codenameone_kotlin.properties
. If you use SDKMAN, and result ofsdk h kotlin 1.4.10
is/Users/bmalkow/.sdkman/candidates/kotlin/1.4.10%
then line in this file should looks like:kotlin.lib=/Users/bmalkow/.sdkman/candidates/kotlin/1.4.10/lib
Or simply grab this file from other CN1 project what works.
-
This helped but your suggested solution has a few problems:
- First, it points to the most recent version of Kotlin - 1.4.x which is incompatible with CN1
- Minor and easily fixable, it points to a user's home folder which then causes problem when the project is compiled on different user's computer
I think it IntelliJ is usually installed in standard location, so, it would be best to use path to the IntelliJ Kotlin plugin location, which makes it most portable. Then it does not directly depends on Kotlin version. Like this:
kotlin.lib=/Applications/IntelliJ IDEA.app/Contents/plugins/Kotlin/kotlinc/lib
In any case, the CN1 supports only Kotlin ver. 1.3.72, and the library compilation fails under this Kotlin version. I would suggest to install in IntelliJ kotlin plugin for this particular version of the Kotlin, to make sure our code is compatible.
Here is compilation output:
kobit:halcyon-cn1/ (master) $ ant jar [13:10:19] Buildfile: /Users/kobit/projects/halcyon-cn1/build.xml -pre-init: -init-private: -init-user: -init-project: -init-macrodef-property: -do-init: -post-init: -init-check: -init-ap-cmdline-properties: -init-macrodef-javac-with-processors: -init-macrodef-javac-without-processors: -init-macrodef-javac: -init-macrodef-test-impl: -init-macrodef-junit-init: -init-macrodef-junit-single: -init-macrodef-junit-batch: -init-macrodef-junit: -init-macrodef-junit-impl: -init-macrodef-testng: -init-macrodef-testng-impl: -init-macrodef-test: -init-macrodef-junit-debug: -init-macrodef-junit-debug-batch: -init-macrodef-junit-debug-impl: -init-macrodef-test-debug-junit: -init-macrodef-testng-debug: -init-macrodef-testng-debug-impl: -init-macrodef-test-debug-testng: -init-macrodef-test-debug: -init-debug-args: -init-macrodef-nbjpda: -init-macrodef-debug: -init-macrodef-java: -init-presetdef-jar: -init-ap-cmdline-supported: -init-ap-cmdline: init: -deps-jar-init: [delete] Deleting: /Users/kobit/projects/halcyon-cn1/build/built-jar.properties deps-jar: -warn-already-built-jar: [propertyfile] Updating property file: /Users/kobit/projects/halcyon-cn1/build/built-jar.properties -check-automatic-build: -clean-after-automatic-build: -verify-automatic-build: -pre-pre-compile: -pre-compile: [echo] Compile is forcing compliance to the supported API's/features for maximum device compatibility. This allows smaller [echo] code size and wider device support [javac] Compiling 126 source files to /Users/kobit/projects/halcyon-cn1/build/tmp [javac] Compiling [/Users/kobit/projects/halcyon-cn1/src] => [/Users/kobit/projects/halcyon-cn1/build/tmp] [javac] warning: classpath entry points to a non-existent location: /Users/kobit/projects/halcyon-cn1/override [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/requests/AbstractRequest.kt:37:40: error: the feature "trailing commas" is only available since language version 1.4 [javac] private val callHandlerOnSent: Boolean, [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/requests/RequestBuilder.kt:75:28: error: the feature "trailing commas" is only available since language version 1.4 [javac] callHandlerOnSent: Boolean, [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/requests/RequestBuilder.kt:90:42: error: the feature "trailing commas" is only available since language version 1.4 [javac] private val transform: (value: Any) -> V, [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/avatar/UserAvatarModule.kt:133:104: error: the feature "trailing commas" is only available since language version 1.4 [javac] val bytes: Int, val height: Int?, val id: String, val type: String, val url: String?, val width: Int?, [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/caps/EntityCapabilitiesModule.kt:40:95: error: the feature "trailing commas" is only available since language version 1.4 [javac] val node: String, val identities: List<DiscoveryModule.Identity>, val features: List<String>, [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/discovery/DiscoveryModule.kt:45:94: error: the feature "trailing commas" is only available since language version 1.4 [javac] val jid: JID, val node: String?, val identities: List<Identity>, val features: List<String>, [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/jingle/AstractJingleSession.kt:33:36: error: the feature "trailing commas" is only available since language version 1.4 [javac] val initiationType: InitiationType, [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/jingle/JingleModule.kt:63:47: error: the feature "trailing commas" is only available since language version 1.4 [javac] val supportsMessageInitiation: Boolean = true, [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/jingle/JingleModule.kt:148:44: error: the feature "trailing commas" is only available since language version 1.4 [javac] action: MessageInitiationAction, jid: JID, [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/jingle/JingleModule.kt:178:72: error: the feature "trailing commas" is only available since language version 1.4 [javac] jid: JID, sid: String, contents: List<Content>, bundle: List<String>?, [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/jingle/JingleModule.kt:209:72: error: the feature "trailing commas" is only available since language version 1.4 [javac] jid: JID, sid: String, contents: List<Content>, bundle: List<String>?, [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/jingle/JingleModule.kt:275:27: error: the feature "trailing commas" is only available since language version 1.4 [javac] val bundle: List<String>?, [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/mam/MAMModule.kt:39:111: error: the feature "trailing commas" is only available since language version 1.4 [javac] val resultStanza: Message, val queryId: String, val id: String, val forwardedStanza: ForwardedStanza<Message>, [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/mam/MAMModule.kt:119:81: error: the feature "trailing commas" is only available since language version 1.4 [javac] rsm: RSM? = null, with: String? = null, start: Long? = null, end: Long? = null, [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/mix/MIXModule.kt:152:96: error: the feature "trailing commas" is only available since language version 1.4 [javac] invitee: BareJID, channel: BareJID, inviter: BareJID = myJID().bareJID, token: String? = null, [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/mix/MIXModule.kt:169:68: error: the feature "trailing commas" is only available since language version 1.4 [javac] channel: BareJID, nick: String, invitation: MIXInvitation? = null, [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/presence/PresenceModule.kt:41:99: error: the feature "trailing commas" is only available since language version 1.4 [javac] val jid: BareJID, val status: String?, val presence: Presence, val lastReceivedPresence: Presence, [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/presence/PresenceModule.kt:98:91: error: the feature "trailing commas" is only available since language version 1.4 [javac] jid: JID? = null, type: PresenceType? = null, show: Show? = null, status: String? = null, [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/presence/PresenceModule.kt:142:46: error: unresolved reference: minByOrNull [javac] .map { presence -> Envelope(presence) }.minByOrNull { envelope -> envelope.comp }?.presence [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/presence/PresenceModule.kt:142:60: error: cannot infer a type for this parameter. Please specify it explicitly. [javac] .map { presence -> Envelope(presence) }.minByOrNull { envelope -> envelope.comp }?.presence [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/pubsub/PubSubModule.kt:46:90: error: the feature "trailing commas" is only available since language version 1.4 [javac] val pubSubJID: JID?, val stanza: Message, val nodeName: String, val items: List<Element>, [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/pubsub/PubSubModule.kt:116:89: error: the feature "trailing commas" is only available since language version 1.4 [javac] val node: String, val jid: JID, var state: SubscriptionState, var subid: String? = null, [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/pubsub/PubSubModule.kt:149:67: error: the feature "trailing commas" is only available since language version 1.4 [javac] pubSubJID: JID, node: String, configForm: JabberDataForm? = null, [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/pubsub/PubSubModule.kt:234:53: error: the feature "trailing commas" is only available since language version 1.4 [javac] requestXMLNS: String, pubSubJID: JID, node: String, [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/pubsub/PubSubModule.kt:274:31: error: the feature "trailing commas" is only available since language version 1.4 [javac] pubSubJID: JID, node: String, [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/pubsub/PubSubModule.kt:301:66: error: the feature "trailing commas" is only available since language version 1.4 [javac] pubSubJID: JID, node: String, subscriptions: List<Subscription>, [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/pubsub/PubSubModule.kt:383:49: error: the feature "trailing commas" is only available since language version 1.4 [javac] jid: JID, node: String, itemId: String? = null, [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/pubsub/PubSubModule.kt:432:69: error: the feature "trailing commas" is only available since language version 1.4 [javac] jid: JID?, node: String, itemId: String?, payload: Element? = null, [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/pubsub/PubSubModule.kt:479:34: error: the feature "trailing commas" is only available since language version 1.4 [javac] jid: JID?, node: String? = null, [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/roster/RosterModule.kt:76:61: error: the feature "trailing commas" is only available since language version 1.4 [javac] val annotations: Array<RosterItemAnnotation> = emptyArray(), [javac] ^ BUILD FAILED /Users/kobit/projects/halcyon-cn1/build.xml:32: Compile failed; see the compiler error output for details. Total time: 12 seconds
-
I removed all "trailing comas" errors but still the compilation fails with the following errors:
kobit:halcyon-cn1/ (master*) $ ant jar [13:56:16] Buildfile: /Users/kobit/projects/halcyon-cn1/build.xml -pre-init: -init-private: -init-user: -init-project: -init-macrodef-property: -do-init: -post-init: -init-check: -init-ap-cmdline-properties: -init-macrodef-javac-with-processors: -init-macrodef-javac-without-processors: -init-macrodef-javac: -init-macrodef-test-impl: -init-macrodef-junit-init: -init-macrodef-junit-single: -init-macrodef-junit-batch: -init-macrodef-junit: -init-macrodef-junit-impl: -init-macrodef-testng: -init-macrodef-testng-impl: -init-macrodef-test: -init-macrodef-junit-debug: -init-macrodef-junit-debug-batch: -init-macrodef-junit-debug-impl: -init-macrodef-test-debug-junit: -init-macrodef-testng-debug: -init-macrodef-testng-debug-impl: -init-macrodef-test-debug-testng: -init-macrodef-test-debug: -init-debug-args: -init-macrodef-nbjpda: -init-macrodef-debug: -init-macrodef-java: -init-presetdef-jar: -init-ap-cmdline-supported: -init-ap-cmdline: init: -deps-jar-init: [delete] Deleting: /Users/kobit/projects/halcyon-cn1/build/built-jar.properties deps-jar: -warn-already-built-jar: [propertyfile] Updating property file: /Users/kobit/projects/halcyon-cn1/build/built-jar.properties -check-automatic-build: -clean-after-automatic-build: -verify-automatic-build: -pre-pre-compile: -pre-compile: [echo] Compile is forcing compliance to the supported API's/features for maximum device compatibility. This allows smaller [echo] code size and wider device support [javac] Compiling 126 source files to /Users/kobit/projects/halcyon-cn1/build/tmp [javac] Compiling [/Users/kobit/projects/halcyon-cn1/src] => [/Users/kobit/projects/halcyon-cn1/build/tmp] [javac] warning: classpath entry points to a non-existent location: /Users/kobit/projects/halcyon-cn1/override [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/presence/PresenceModule.kt:142:46: error: unresolved reference: minByOrNull [javac] .map { presence -> Envelope(presence) }.minByOrNull { envelope -> envelope.comp }?.presence [javac] ^ [javac] /Users/kobit/projects/halcyon-cn1/src/tigase/halcyon/core/xmpp/modules/presence/PresenceModule.kt:142:60: error: cannot infer a type for this parameter. Please specify it explicitly. [javac] .map { presence -> Envelope(presence) }.minByOrNull { envelope -> envelope.comp }?.presence [javac] ^ BUILD FAILED /Users/kobit/projects/halcyon-cn1/build.xml:32: Compile failed; see the compiler error output for details. Total time: 11 seconds
-
Minor side-comment:
I think it IntelliJ is usually installed in standard location, so, it would be best to use path to the IntelliJ Kotlin plugin location, which makes it most portable. Then it does not directly depends on Kotlin version. Like this:
kotlin.lib=/Applications/IntelliJ IDEA.app/Contents/plugins/Kotlin/kotlinc/lib
This doesn't seem to be the case if you use JetbrainsToolbox to install Idea. In that case it's
/Users/wojtek/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
. Moreover, above location still is "fixed" and tied to the OS. -
Thank you for the input.
I gave up on Toolbox a while ago because it messed licenses up for me. It was always confused which IDE is licensed and which is Community.
The above location, I gave is fixed, indeed and indeed OS dependent but at least it is stable on this OS. And right now we all use the same OS, so it seems like the best solution.
However, I am open to different suggestions. I am not sure if the properties file can use ENV variables. If it could, then universal solution would be very simple and easy. If it cannot have use ENV variables we could all agree on one, fixed location for kotlinc and then have a fixed location in the properties file.
-
Ok, I found a solution which seems to be working. It is, indeed, based on ENV variables. It does need a little bit of editing build file and properties but these are really minor
build.xml file modifications - add a single line:
<property environment="env" />
Just after second XML line starting with
<description>
and it must be before line with kotlin properties file loading:<property file="codenameone_kotlin.properties"/>
In my case, the beginning of the build.xml file looks like this:
<project name="LibraryProject" default="default" basedir="."> <description>Builds, tests, and runs the project LibraryProject.</description> <property environment="env" /> <property file="codenameone_kotlin.properties"/> <typedef resource="org/jetbrains/kotlin/ant/antlib.xml" classpath="${kotlin.lib}/kotlin-ant.jar"/> <import file="nbproject/build-impl.xml"/> <property file="codenameone_settings.properties"/> <!-- following target was just added for testing purposes and can be skipped --> <target name="testProps"> <echo message="${env.KOTLINC_LIB}"/> <echo message="${kotlin.lib}"/> </target>
Now the
codenameone_kotlin.properties
file should look like this:#Kotlin properties automatically updated at 1596694293813 #Thu Aug 06 08:11:33 CEST 2020 kotlin.lib=${env.KOTLINC_LIB}
Of course the
KOTLINC_LIB
env variable must be set to a correct path:$ export KOTLINC_LIB="/Applications/IntelliJ IDEA.app/Contents/plugins/Kotlin/kotlinc/lib"
This should solve the problem on all platforms and OSes and different way we have system configured.
@bmalkow as you maintain the code repo, could you please make the necessary adjustments in the build files?
According to your comments, in order to get new version of the library I should do:
However, I am getting error and I am unable to compile the project:
Please assist with the project compilation. Perhaps I am missing something or maybe I need some additional tools?