niktekusho / jsweet-gradle-plugin

Brings the power of JSweet to Gradle

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JSweet Gradle plugin

Brings the power of JSweet to Gradle

Usage

Add the JSweet's repositories and the Gradle plugin dependency to your project's build.gradle, in the buildScript section:

buildscript {
	repositories {
		mavenCentral()
		maven { url "http://repository.jsweet.org/artifactory/libs-release-local" }
		maven { url "http://repository.jsweet.org/artifactory/libs-snapshot-local" }
		maven { url "http://repository.jsweet.org/artifactory/plugins-release-local" }
		maven { url "http://repository.jsweet.org/artifactory/plugins-snapshot-local" }
		maven { url "http://google-diff-match-patch.googlecode.com/svn/trunk/maven" }
	}
	dependencies {
		classpath('org.jsweet:jsweet-gradle-plugin:3.0.0') { //
			transitive = true }
	}
}

Then apply the JSweet Gradle plugin, as usual:

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

and optionally disable java compilation (JSweet sources may not be considered as standard java sources):

compileJava {
	enabled = false
}

Add your JSweet dependencies (candies):

dependencies {
	compile group: 'org.jsweet', name: 'jsweet-transpiler', version: "3.0.0"
	compile group: 'org.jsweet', name: 'jsweet-core', version: "6"
	compile group: 'org.jsweet.candies', name: 'angular', version: "1.4.0-20170726"
	compile group: 'org.jsweet.candies', name: 'angular-route', version: "1.2.0-20170726"
}

Configure the JSweet plugin:

jsweet {
	verbose = true
	encoding = 'UTF-8'
	sourceMap = true
	outDir = project.file('target/javascript')
	candiesJsOut = project.file('target/candies')
	targetVersion = 'ES6'
	includes = ['**/fr/test/my/**/*.java']
	
	// extraSystemPath = '/my/path/to/npm'
}

The configuration options are based on the JSweet maven plugin options, please refer to its README for a comprehensive documentation: https://github.com/lgrignon/jsweet-maven-plugin#basic-configuration

Then, just invoke one of the JSweet gradle task:

$ gradle jsweet
$ gradle jsweetClean

Development / Contribution / Deploy

Configure signing

Add those lines to your ~/.gradle/gradle.properties:

signing.keyId=01695460
signing.password=...
signing.secretKeyRingFile=path/to/secrets.gpg

To regenerate this file from the gpg DB, use the following command:

gpg --export-secret-keys > path/to/secrets.gpg

To show short key ID (8 chars):

gpg --list-keys --keyid-format short

Or you can skip signing with:

./gradlew ... -DskipSigning=true

Install

Install with:

./gradlew clean publishToMavenLocal

Deploy (needs credentials)

# on JSweet's repository
./gradlew clean publish

# on central Gradle plugins repository
./gradlew clean publishPlugins

About

Brings the power of JSweet to Gradle

License:Apache License 2.0


Languages

Language:Java 96.6%Language:TypeScript 1.8%Language:JavaScript 1.6%