Skip to content

Commit

Permalink
Revert plugin change, apply rules to change groupId, and clean up old…
Browse files Browse the repository at this point in the history
… code
  • Loading branch information
niloc132 committed Jun 5, 2024
1 parent dd6e350 commit cfbe4ca
Show file tree
Hide file tree
Showing 13 changed files with 148 additions and 209 deletions.
2 changes: 1 addition & 1 deletion buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ repositories {
}

dependencies {
implementation('org.docstr:gwt-gradle-plugin:1.1.30') {
implementation('de.esoco.gwt:gwt-gradle-plugin:1.2.0') {
exclude group: 'org.codehaus.groovy'
because('needed for GwtTools')
}
Expand Down
275 changes: 138 additions & 137 deletions buildSrc/src/main/groovy/GwtTools.groovy
Original file line number Diff line number Diff line change
@@ -1,137 +1,138 @@
//import de.esoco.gwt.gradle.GwtLibPlugin
//import de.esoco.gwt.gradle.GwtPlugin
//import de.esoco.gwt.gradle.extension.GwtExtension
//import de.esoco.gwt.gradle.task.GwtCheckTask
//import de.esoco.gwt.gradle.task.GwtCompileTask
//import groovy.transform.CompileStatic
//import org.gradle.api.Project
//import org.gradle.api.artifacts.ProjectDependency
//import org.gradle.api.file.ConfigurableFileCollection
//import org.gradle.api.plugins.JavaPlugin
//import org.gradle.api.tasks.compile.JavaCompile
//
//import java.nio.file.Files
//
///**
// * Helper to simplify / centralize configuring gwt plugins in build files
// */
//@CompileStatic
//class GwtTools {
//
// static GwtExtension gwtLib(Project p) {
// p.plugins.apply(GwtLibPlugin)
// GwtExtension ext = p.extensions.getByType(GwtExtension)
// applyDefaults(p, ext)
// return ext
// }
// static GwtExtension gwtCompile(Project p, String module, String description) {
// p.plugins.apply(GwtPlugin)
// GwtExtension ext = p.extensions.getByType(GwtExtension)
// applyDefaults(p, ext, true)
//
// // Apply our module settings to and gwtc task;
// // currently, there should only be one such task,
// // but we used to have two, and may have two again later,
// // so we'll leave this setup to be friendly-for-reuse
// p.tasks.withType(GwtCompileTask).all {
// GwtCompileTask gwtc ->
// applyModuleSettings p, gwtc, module,description
// }
// // This GWT plugin will fail if tests are run after compilation, instead
// // we suppress running the test at all, and ensure that it doesn't check
// // if it even can be run until after compile finishes.
// p.tasks.withType(GwtCheckTask).configureEach {t ->
// t.mustRunAfter(p.tasks.withType(GwtCompileTask))
// t.onlyIf { false }
// }
//
// return ext
// }
//
// static void applyModuleSettings(Project p, GwtCompileTask gwtc, String mod, String description) {
// gwtc.onlyIf WebTools.&shouldRun
// boolean gwtDev = p.findProperty('gwtDev') == 'true'
// String extras = new File(p.buildDir, "gwt/dhapi/extra").absolutePath
//
// GwtExtension gwt = p.extensions.findByType(GwtExtension)
//
// gwt.with {
// module "${mod}${gwtDev ? 'Dev' : ''}"
// compile.with {
// style = 'PRETTY'
// generateJsInteropExports = true
// // TODO move this down a line when we want to give clients js that is not super strict / rigged to blow
// checkAssertions = true
// if (gwtDev) {
// saveSource = true
// extra = extras
// logLevel = 'INFO'
// draftCompile = true
// }
// }
// }
//
// p.gradle.projectsEvaluated {
// addGeneratedSources(p, gwtc)
// }
//
// gwtDev && gwtc.doFirst {
// gwtc.logger.quiet('Running in gwt dev mode; saving source to {}/dh/src', extras)
// }
// }
//
// static void applyDefaults(Project p, GwtExtension gwt, boolean compile = false) {
// gwt.gwtVersion = Classpaths.GWT_VERSION
// gwt.jettyVersion = Classpaths.JETTY_VERSION
// p.configurations.each {
// it.exclude group: 'net.sourceforge.htmlunit'
// it.exclude group: 'org.eclipse.jetty'
// }
// if (compile) {
//
// String warPath = new File(p.buildDir, 'gwt').absolutePath
//
// gwt.compile.with {
// // See https://github.com/esoco/gwt-gradle-plugin for all options
// /** The level of logging detail (ERROR, WARN, INFO, TRACE, DEBUG, SPAM, ALL) */
// logLevel = "INFO"
// /** Where to write output files */
// war = warPath
// /** Compile a report that tells the "Story of Your Compile". */
// compileReport = false
// /** Compile quickly with minimal optimizations. */
// draftCompile = false
// /** Include assert statements in compiled output. */
// checkAssertions = false
// /** Script output style. (OBF, PRETTY, DETAILED)*/
// style = "OBF"
// /** Sets the optimization level used by the compiler. 0=none 9=maximum. */
// optimize = 9
// /** Fail compilation if any input file contains an error. */
// strict = true
// /** Specifies Java source level. ("1.6", "1.7")*/
// sourceLevel = "11"
// /** The number of local workers to use when compiling permutations. */
// localWorkers = 1
// /** Emit extra information allow chrome dev tools to display Java identifiers in many places instead of JavaScript functions. (NONE, ONLY_METHOD_NAME, ABBREVIATED, FULL)*/
//// methodNameDisplayMode = "NONE"
//
// /** Java args */
// maxHeapSize = "1024m"
// minHeapSize = "512m"
// }
// }
// }
//
// static void addGeneratedSources(Project project, GwtCompileTask gwtc) {
// if (project.configurations.getByName(JavaPlugin.ANNOTATION_PROCESSOR_CONFIGURATION_NAME).dependencies) {
// (gwtc.src as ConfigurableFileCollection).from(
// (project.tasks.getByName(JavaPlugin.COMPILE_JAVA_TASK_NAME) as JavaCompile).options.generatedSourceOutputDirectory
// )
// }
// project.configurations.getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME).allDependencies.withType(ProjectDependency)*.dependencyProject*.each {
// Project p -> addGeneratedSources(p, gwtc)
// }
// }
//
//}
import de.esoco.gwt.gradle.GwtLibPlugin
import de.esoco.gwt.gradle.GwtPlugin
import de.esoco.gwt.gradle.extension.GwtExtension
import de.esoco.gwt.gradle.task.GwtCheckTask
import de.esoco.gwt.gradle.task.GwtCompileTask
import groovy.transform.CompileStatic
import org.gradle.api.Project
import org.gradle.api.artifacts.Configuration
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.plugins.JavaPlugin
import org.gradle.api.tasks.compile.JavaCompile

/**
* Helper to simplify / centralize configuring gwt plugins in build files
*/
@CompileStatic
class GwtTools {

static GwtExtension gwtLib(Project p) {
p.plugins.apply(GwtLibPlugin)
GwtExtension ext = p.extensions.getByType(GwtExtension)
applyDefaults(p, ext)
return ext
}
static GwtExtension gwtCompile(Project p, String module, String description) {
p.plugins.apply(GwtPlugin)
GwtExtension ext = p.extensions.getByType(GwtExtension)
applyDefaults(p, ext, true)

// Apply our module settings to and gwtc task;
// currently, there should only be one such task,
// but we used to have two, and may have two again later,
// so we'll leave this setup to be friendly-for-reuse
p.tasks.withType(GwtCompileTask).all {
GwtCompileTask gwtc ->
applyModuleSettings p, gwtc, module,description
}
// This GWT plugin will fail if tests are run after compilation, instead
// we suppress running the test at all, and ensure that it doesn't check
// if it even can be run until after compile finishes.
p.tasks.withType(GwtCheckTask).configureEach {t ->
t.mustRunAfter(p.tasks.withType(GwtCompileTask))
t.onlyIf { false }
}

return ext
}

static void applyModuleSettings(Project p, GwtCompileTask gwtc, String mod, String description) {
gwtc.onlyIf WebTools.&shouldRun
boolean gwtDev = p.findProperty('gwtDev') == 'true'
String extras = new File(p.buildDir, "gwt/dhapi/extra").absolutePath

GwtExtension gwt = p.extensions.findByType(GwtExtension)

gwt.with {
module "${mod}${gwtDev ? 'Dev' : ''}"
compile.with {
style = 'PRETTY'
generateJsInteropExports = true
// TODO move this down a line when we want to give clients js that is not super strict / rigged to blow
checkAssertions = true
if (gwtDev) {
saveSource = true
extra = extras
logLevel = 'INFO'
draftCompile = true
}
}
}

p.gradle.projectsEvaluated {
addGeneratedSources(p, gwtc)
}

gwtDev && gwtc.doFirst {
gwtc.logger.quiet('Running in gwt dev mode; saving source to {}/dh/src', extras)
}
}

static void applyDefaults(Project p, GwtExtension gwt, boolean compile = false) {
gwt.gwtVersion = Classpaths.GWT_VERSION
gwt.jettyVersion = Classpaths.JETTY_VERSION
p.configurations.all { Configuration c ->
c.resolutionStrategy.dependencySubstitution { sub ->
sub.substitute(sub.module("com.google.gwt:gwt-codeserver")).using(sub.module('org.gwtproject:gwt-codeserver:2.11.0'))
sub.substitute(sub.module("com.google.gwt:gwt-user")).using(sub.module('org.gwtproject:gwt-user:2.11.0'))
sub.substitute(sub.module("com.google.gwt:gwt-dev")).using(sub.module('org.gwtproject:gwt-dev:2.11.0'))
}
}
if (compile) {
String warPath = new File(p.buildDir, 'gwt').absolutePath

gwt.compile.with {
// See https://github.com/esoco/gwt-gradle-plugin for all options
/** The level of logging detail (ERROR, WARN, INFO, TRACE, DEBUG, SPAM, ALL) */
logLevel = "INFO"
/** Where to write output files */
war = warPath
/** Compile a report that tells the "Story of Your Compile". */
compileReport = false
/** Compile quickly with minimal optimizations. */
draftCompile = false
/** Include assert statements in compiled output. */
checkAssertions = false
/** Script output style. (OBF, PRETTY, DETAILED)*/
style = "OBF"
/** Sets the optimization level used by the compiler. 0=none 9=maximum. */
optimize = 9
/** Fail compilation if any input file contains an error. */
strict = true
/** Specifies Java source level. ("1.6", "1.7")*/
sourceLevel = "11"
/** The number of local workers to use when compiling permutations. */
localWorkers = 1
/** Emit extra information allow chrome dev tools to display Java identifiers in many places instead of JavaScript functions. (NONE, ONLY_METHOD_NAME, ABBREVIATED, FULL)*/
// methodNameDisplayMode = "NONE"

/** Java args */
maxHeapSize = "1024m"
minHeapSize = "512m"
}
}
}

static void addGeneratedSources(Project project, GwtCompileTask gwtc) {
if (project.configurations.getByName(JavaPlugin.ANNOTATION_PROCESSOR_CONFIGURATION_NAME).dependencies) {
(gwtc.src as ConfigurableFileCollection).from(
(project.tasks.getByName(JavaPlugin.COMPILE_JAVA_TASK_NAME) as JavaCompile).options.generatedSourceOutputDirectory
)
}
project.configurations.getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME).allDependencies.withType(ProjectDependency)*.dependencyProject*.each {
Project p -> addGeneratedSources(p, gwtc)
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,4 @@ repositories {
includeGroup 'org.apache.kafka'
}
}
// maven {
// url 'https://oss.sonatype.org/content/repositories/snapshots/'
// }
mavenLocal()
}
8 changes: 0 additions & 8 deletions gradle/web-client.gradle

This file was deleted.

20 changes: 0 additions & 20 deletions gradle/web-common.gradle

This file was deleted.

2 changes: 0 additions & 2 deletions open-api/lang-parser/lang-parser.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ plugins {
id 'io.deephaven.project.register'
}

apply from: "$rootDir/gradle/web-common.gradle"

dependencies {
implementation project(':Util')
api project(':open-api-shared-fu')
Expand Down
2 changes: 0 additions & 2 deletions open-api/lang-tools/lang-tools.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ plugins {
id 'java-library'
}

apply from: "$rootDir/gradle/web-common.gradle"

Classpaths.inheritCommonsText(project, 'implementation')
dependencies {

Expand Down
2 changes: 0 additions & 2 deletions open-api/shared-fu/shared-fu.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,4 @@ plugins {
id 'io.deephaven.project.register'
}

apply from: "$rootDir/gradle/web-common.gradle"

// Contains all general purpose utilities used across all open-api modules.
23 changes: 2 additions & 21 deletions web/client-api/client-api.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,9 @@ import io.deephaven.tools.docker.WaitForHealthyContainer
plugins {
id 'io.deephaven.project.register'
id 'io.deephaven.deephaven-in-docker'
id 'gwt-compiler'
}

evaluationDependsOn(Docker.registryProject('selenium'))
evaluationDependsOn ':web-shared-beans'
evaluationDependsOn ':web-client-backplane'

apply from: "$rootDir/gradle/web-client.gradle"

configurations {
js
Expand All @@ -39,26 +34,12 @@ Classpaths.inheritElemental(project, 'elemental2-core', 'implementation')
Classpaths.inheritElemental(project, 'elemental2-promise', 'implementation')
Classpaths.inheritElemental(project, 'elemental2-dom', 'implementation')

gwt {
gwtVersion = Classpaths.GWT_VERSION
modules 'io.deephaven.web.DeephavenApi'

src += files(project.files(project(':web-shared-beans').sourceSets.main.allSource.srcDirs))
src += files(project.files(project(':web-client-backplane').sourceSets.main.allSource.srcDirs))
src += files(project.files(project(':open-api-shared-fu').sourceSets.main.allSource.srcDirs))

maxHeapSize '1024m'

jsInteropExports {
setGenerate true
}
// extraDir layout.buildDirectory.dir('gwt/extra')
}
GwtTools.gwtCompile project, 'io.deephaven.web.DeephavenApi', 'Create a jar of client JS API'

def jsOutput = layout.buildDirectory.dir('js')
def gwtOutput = tasks.register('gwtOutput', Sync) {
includeEmptyDirs = false
from(tasks.getByName('compileGwt').outputs.files) {
from(tasks.getByName('gwtCompile').outputs.files) {
// only copy the dhapi module, and don't give it a wrapper directory
include 'dhapi/**'
eachFile { it.path = 'jsapi/' + it.path.substring('dhapi/'.length()) }
Expand Down
Loading

0 comments on commit cfbe4ca

Please sign in to comment.