lgrignon / jsweet-gradle-plugin

Brings the power of JSweet to Gradle
Apache License 2.0
17 stars 15 forks source link

jsweet plugin only generating empty js and ts file #27

Closed Skillzore closed 3 years ago

Skillzore commented 3 years ago

I have finally got the jsweet plugin to run properly with my gradle build:

$ ./gradlew jsweet            

Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.5/userguide/command_line_interface.html#sec:command_line_warnings

BUILD SUCCESSFUL in 4s
1 actionable task: 1 executed

However, the generated js and ts files are empty. The target directory is created and looks like this: image But both .tsc-rootfile.ts and the .tsc-rootfile.js are empty, and the map file seems to have one mapping between the empty rootfiles. My build.gradle looks like this:

buildscript {
    repositories {
        mavenCentral()
        maven { url "http://repository.jsweet.org/artifactory/libs-release-local" }
    }
    dependencies {
        classpath('org.jsweet:jsweet-gradle-plugin:3.0.0') { //
            transitive = true }
    }
}

plugins {
    id 'org.springframework.boot' version '2.4.1'
    id 'io.spring.dependency-management' version '1.0.10.RELEASE'
    id 'java'
}

group = 'com.myapp'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

repositories {
    mavenCentral()
    maven { url "http://repository.jsweet.org/artifactory/libs-release-local" }
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
    implementation 'org.springframework.boot:spring-boot-starter-web'
    runtimeOnly 'com.h2database:h2'
    testImplementation 'org.springframework.boot:spring-boot-starter-test'
    compile group: 'org.jsweet', name: 'jsweet-transpiler', version: "3.0.0"
}

compileJava {
    enabled = false
}

apply plugin: 'org.jsweet.jsweet-gradle-plugin'

jsweet {
    verbose = true
    encoding = 'UTF-8'
    sourceMap = true
    tsOut = project.file('target/typescript')
    outDir = project.file('target/javascript')
    candiesJsOut = project.file('target/candies')
    targetVersion = 'ES6'
    includes = ['**/src/main/java/com/myapp/pocjsweet/validate.java']

    // extraSystemPath = '/my/path/to/npm'
}

test {
    useJUnitPlatform()
}

What am I missing here for it to transpile my validate.java file correctly?

lgrignon commented 3 years ago

include is source set relative if my memory is correct. Again, please refer to build.gradle in jsweet-examples

Skillzore commented 3 years ago

Sorry, but removing the src/main/java, and only leaving '**/com/myapp/pocjsweet/validate.java' as the path has the same result, empty files.

Skillzore commented 3 years ago

Oh, no. Ran a jsweetClean now first and now it works. Thanks!