internal

Clone Tools
  • last updated a few seconds ago
Constraints
Constraints: committers
 
Constraints: files
Constraints: dates
Replace usage of `String#format` with good old string concatenation

The rationale behind this change is that while `String#format` is usually admitted as good for readability (this is arguable),

in practice it is very bad for performance. Since Java 6, the JVM (the JIT, to be correct) does a pretty good job at optimizing

string concatenation. However, it is only capable to do so if we're using "dirty" string concatenations (using `+`), or `StringBuilder`.

However, usage of `StringBuilder` is not recommended either for 2 reasons:

1. it significantly decreases code readability

2. in Java 9, String concatenation is even more optimized thanks to `invokedynamic`, and code using `StringBuilder` will *not* benefit

from this optimization.

There are sill leftover `String#format` calls in the code, in the following cases:

- the call is used to generate an exception message. That's 90% of the remaining calls.

- the call is obviously a debug message, often used in `toString` (because as we all know, `toString` should only be used for debugging)

- the format includes specific number formatting patterns

- I missed it

    • -2
    • +2
    ./jvm/ClassDirectoryBinaryNamingScheme.java
  1. … 220 more files in changeset.
Add 'compileClasspath' configuration to all source sets

- Creates another configuration, 'compileClasspath', for all source sets

- This configuration extends from 'compileOnly'

- Source set's compileClasspath is set to 'compileClasspath' configuration

+review REVIEW-5807

  1. … 17 more files in changeset.
Rename Buildable{ModelElement => ComponentSpec}

This rename better reflects the fact that (the former)

BuildableModelElement now extends ComponentSpec, and in the process

helps to eliminate the unnecessary concept of "model elements" in favor

of referring to everything in terms of components and component specs.

Javadoc in BuildableComponentSpec and certain parameters and member

variables in AbstractBuildableComponentSpec have also been updated and

renamed for clarity and consistency.

    • -2
    • +2
    ./jvm/DefaultClassDirectoryBinarySpec.java
  1. … 25 more files in changeset.
Removed concept of 'parent' for an `AbstractLanguageSourceSet`, this information is now carried in the id for the source set.

  1. … 19 more files in changeset.
Changed `DefaultClassDirectoryBinarySpec` so that it behaves more consistently with the other `ComponentSpec` types, wrt display name.

    • -9
    • +3
    ./jvm/DefaultClassDirectoryBinarySpec.java
  1. … 3 more files in changeset.
Removed the duplication between `BaseLanguageSourceSet` and `AbstractLanguageSourceSet`, and changed `AbstractLanguageSourceSet` to conform to `AbstractBuildableModelElement` contract.

    • -2
    • +2
    ./jvm/DefaultClassDirectoryBinarySpec.java
  1. … 5 more files in changeset.
Moved `AbstractLanguageSourceSet` to live in the `platform-base` project.

    • -88
    • +0
    ./java/AbstractLanguageSourceSet.java
  1. … 1 more file in changeset.
Removed unused suppression.

    • -1
    • +0
    ./jvm/DefaultClassDirectoryBinarySpec.java
Fix public type for `DefaultClassDirectoryBinarySpec`

    • -1
    • +1
    ./jvm/DefaultClassDirectoryBinarySpec.java
Make `DefaultClassDirectoryBinarySpec` conform to `AbstractBuildableModelElement`

    • -12
    • +3
    ./jvm/DefaultClassDirectoryBinarySpec.java
  1. … 1 more file in changeset.
Add 'compileOnly' configuration for each source set.

This commit creates a new 'compileOnly' configuration for each declared source set. Dependencies added to this source set are used during compilation only. They are not included on the runtime classpath, are not inherited by test classpath, are not included in 'deployable' artifacts such as WARs, EARs or application distributions, are not exported to consuming projects, and are not included in published metadata.

+review REVIEW-5807

  1. … 22 more files in changeset.
Changed `LanguageSourceSetFactory` so that it does not reach into the private data of the source set's parent.

    • -0
    • +8
    ./jvm/DefaultClassDirectoryBinarySpec.java
  1. … 2 more files in changeset.
Removed deprecated `source` property from `ComponentSpec` and `BinarySpec`.

    • -5
    • +0
    ./jvm/DefaultClassDirectoryBinarySpec.java
  1. … 7 more files in changeset.
Introduced a factory to create `SourceDirectorySet` instances, to avoid exposing the dependencies of `DefaultSourceDirectorySet` to all the places that need to create a `SourceDirectorySet`.

    • -2
    • +5
    ./tasks/DefaultSourceSetContainer.java
  1. … 35 more files in changeset.
Pushed `JvmBinaryTasks` down to `JarBinarySpec` and use same pattern as for the native binaries to statically declare the tasks.

    • -5
    • +4
    ./jvm/DefaultClassDirectoryBinarySpec.java
  1. … 9 more files in changeset.
Added a fallback renderer to use for any JVM binary spec without a more specific renderer.

This happens to include JUnit test suite binaries.

    • -35
    • +0
    ./jvm/ClassDirectoryBinaryRenderer.java
    • -0
    • +35
    ./jvm/JvmBinaryRenderer.java
  1. … 1 more file in changeset.
Introduce `testing-base` module

This commit introduces a new `testing-base` module aimed at detangling the `plugins` module, by extracting 2 things:

* classes that are used independently of a testing framework or the JVM (`TestDescriptor`, ...)

* classes which are specific to JVM testing (`Test`, `TestReport`, `TestWorker`, ...)

The first category are extracted in the `testing-base` module. The second category have been migrated to the `testing-jvm` module, which now includes TestNG specific classes too.

* The `testing-jvm` module no longer depends on `plugins`, but on `testing-base` instead.

* The `plugins` module now depends on `testing-jvm` (so we have effectively inverted the dependency).

It's worth noting that while main classes have been shuffled around, test classes have not been moved, and some quality checks had to be disabled. For example, strict compilation and classcycle cannot be used anymore in the `testing-jvm` module without introducing breaking changes.

Two classes (`JUnitOptions` and `TestNGOptions`) have been migrated from Groovy to Java.

At this point, building Gradle is broken. Subsequent commits will fix that.

Story: gradle/langos#103

Item: refactor-plugins

    • -41
    • +0
    ./tasks/testing/DefaultJUnitXmlReport.java
    • -33
    • +0
    ./tasks/testing/DefaultTestClassDescriptor.java
    • -41
    • +0
    ./tasks/testing/DefaultTestDescriptor.java
    • -28
    • +0
    ./tasks/testing/DefaultTestMethodDescriptor.java
    • -34
    • +0
    ./tasks/testing/DefaultTestSuiteDescriptor.java
    • -46
    • +0
    ./tasks/testing/TestClassProcessor.java
    • -22
    • +0
    ./tasks/testing/TestClassRunInfo.java
  1. … 264 more files in changeset.
Use the standard Scala `LanguageTransform` in Play support

To make this work, needed to allow ScalaLanguagePlugin to joint compile all

sources for a binary.

This implementation is a basic and somewhat hacky placeholder for true dependency-aware source handling:

- Source sets should be able to depend on other source sets, resulting in the correct task dependencies and inputs

- Joint-compilation should only be used in the case where sources are co-dependent.

Currently we use joint-compilation when:

- We have a language transform that supports joint-compilation

- Binary is flagged with `BinarySpecInternal.hasCodependentSources()`

At this stage, only `PlayApplicationBinarySpec` is flagged with `hasCodependentSources`.

    • -0
    • +5
    ./jvm/DefaultClassDirectoryBinarySpec.java
  1. … 9 more files in changeset.
Modified exception handling when TestNG does not support preserving order or grouping by instances. The NoSuchMethodException is wrapped by a GradleException with a meaningful message.

Made it easier to use `java-lang` plugin without a `JarBinarySpec`

- Moved `getId()` up to `BinarySpecInternal` and `BaseBinarySpec`

- Refactored `DependencyResolvingClasspath`

- The complete set of dependencies is provided

- Does not have any knowledge of Jvm classes

- JavaLanguagePlugin will resolve sourceSet dependencies for a variant that

is not a `JarBinarySpec`

+review REVIEW-5733

    • -0
    • +6
    ./jvm/DefaultClassDirectoryBinarySpec.java
  1. … 5 more files in changeset.
Fixed error handling for explicit setting of groupByInstances option when underlying TestNG does not support it.

Fix typo

Simplified the naming scheme used to the output directories of JVM binaries.

Reused `BinaryNamingScheme` to calculate the output directories for these binaries.

Also added classes dir, resources dir and API jar output paths to components report.

    • -8
    • +1
    ./jvm/ClassDirectoryBinaryRenderer.java
  1. … 24 more files in changeset.
Moved `namingScheme` property up to `BinarySpecInternal` from the native binaries.

Also changed `DefaultBinaryNamingScheme` to deal with binaries with no parent and a name that was provided by something else.

    • -4
    • +11
    ./jvm/DefaultClassDirectoryBinarySpec.java
  1. … 8 more files in changeset.
Incorporated feedback.

    • -4
    • +4
    ./tasks/testing/testng/TestNGSpec.java
  1. … 5 more files in changeset.
Merged `BinaryNamingSchemeBuilder` into `BinaryNamingScheme`.

    • -9
    • +1
    ./jvm/ClassDirectoryBinaryNamingScheme.java
  1. … 12 more files in changeset.
Removed some more `Action` methods from `LanguageSourceSet` subtypes, as these methods are no longer required to mix in the configuration DSL.

+review REVIEW-5708

  1. … 5 more files in changeset.
Removed `LanguageSourceSet.source()` method, as this method is no longer required to mix in the configuration DSL.

+review REVIEW-5708

  1. … 4 more files in changeset.
Removed the various `Action` methods from the software model types, as these methods are no longer required to mix in the configuration DSL.

+review REVIEW-5708

    • -12
    • +0
    ./jvm/DefaultClassDirectoryBinarySpec.java
  1. … 11 more files in changeset.
Fixed some test cases for changes to view types.

+review REVIEW-5708

  1. … 1 more file in changeset.