78425

Gradle doesn't emit kotlin.js

Question:

I'm trying to compile my Kotlin app and set of Kotlin libraries to JavaScript. I've got that working well, but when I try to run it it can't find kotlin.js.

<strong>So what's going on here?</strong> When I compile using IDEA (instead of Gradle), it outputs kotlin.js just fine. I tried making my build script more like an example I found, <a href="https://stackoverflow.com/q/53576840/3939277" rel="nofollow">but that wouldn't compile</a>...

<hr />

Here's a link to the code and project in question: <a href="https://github.com/BlueHuskyStudios/Decision-Cruncher/blob/SO/53582651/build.gradle" rel="nofollow">https://github.com/BlueHuskyStudios/Decision-Cruncher/blob/SO/53582651/build.gradle</a>

Answer1:

<a href="https://kotlinlang.org/docs/tutorials/javascript/getting-started-gradle/getting-started-with-gradle.html" rel="nofollow">Here</a> you can find the code snippet to extract all .js files from Kotlin/JS libraries:

task assembleWeb(type: Sync) { configurations.compile.each { File file -> from(zipTree(file.absolutePath), { includeEmptyDirs = false include { fileTreeElement -> def path = fileTreeElement.path path.endsWith(".js") && (path.startsWith("META-INF/resources/") || !path.startsWith("META-INF/")) } }) } from compileKotlin2Js.destinationDir into "${projectDir}/web" dependsOn classes } assemble.dependsOn assembleWeb

Recommend

  • Google Cloud Builder - Gradle
  • Illegal reflective access operation
  • How to Divide an array on c#?
  • Does Apportable support to build library binary (.a/.so)?
  • aapt.exe'' finished with non-zero exit value 1
  • Application level floating views with navigation in Android
  • Android Studio 1.3 RC3. Google Play services out of date. Requires 7571000 but found 6774470
  • How to generate and display a QR Code in ionic 2
  • Jenkins: FATAL: Could not initialize class hudson.util.ProcessTree$UnixReflection
  • Parse a date string in a specific locale (not timezone!)
  • Webgrid not refreshing after delete MVC
  • Jquery UI tool tip close icon
  • Switching to Release Build causes runtime error in Web Reference
  • Ajax Loaded meta Tags
  • DomPDF {PAGE_NUM} not on first page
  • Xamarin Forms - UWP Fonts
  • How to get address from latitude and longitude android google map v2 [duplicate]
  • Installing Hadoop, Java Exception about illegal characters at index 7?
  • Javascript simulate pressing enter in input box
  • RectangularRangeIndicator format like triangular using dojo
  • Cross-Platform Protobuf Serialization
  • Shallow update not allowed (git > 1.9)
  • Arrow is showed instead of the material design version hamburger icon. Why doesn't syncState in
  • Convert array of 8 bytes to signed long in C++
  • Importing jscolor library in angular 2
  • QuartzCore.framework for Mono Develop
  • How do I rollback to a specific git commit
  • Compare two NSDates in iPhone
  • Arrays break string types in Julia
  • Traverse Array and Display in markup
  • A cron job substitute?
  • Revoking OAuth Access Token Results in 404 Not Found
  • Acquiring multiple attributes from .xml file in c#
  • -fvisibility=hidden not passed by compiler for Debug builds
  • How to CLICK on IE download dialog box i.e.(Open, Save, Save As…)
  • Qt: Run a script BEFORE make
  • How can I remove ASP.NET Designer.cs files?
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass
  • java string with new operator and a literal
  • Net Present Value in Excel for Grouped Recurring CF