Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ExampleTest {
@DisplayName("I can compile a Hello World application")
@JavacCompilerTest
void canCompileHelloWorld(Compilable<?, ?> compiler) {
var sources = newRamFileSystem("src")
var sources = newRamDirectory("src")
.createFile("org/example/Message.java").withContents(
"""
package org.example;
Expand Down Expand Up @@ -83,7 +83,7 @@ class ExampleTest {
@JavacCompilerTest(modules = true)
void canCompileModuleUsingLombok(Compilable<?, ?> compiler) {
// Given
var sources = newRamFileSystem("hello.world")
var sources = newRamDirectory("hello.world")
.createFile("org/example/Message.java").withContents(
"""
package org.example;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package io.github.ascopes.jct.acceptancetests.checkerframework

import io.github.ascopes.jct.compilers.Compilable
import io.github.ascopes.jct.compilers.Compiler
import io.github.ascopes.jct.junit.JavacCompilerTest
import org.checkerframework.checker.nullness.NullnessChecker
import org.junit.jupiter.api.BeforeEach
Expand All @@ -25,7 +25,7 @@ import org.junit.jupiter.api.parallel.Execution
import org.junit.jupiter.api.parallel.ExecutionMode

import static io.github.ascopes.jct.assertions.JctAssertions.assertThatCompilation
import static io.github.ascopes.jct.pathwrappers.RamFileSystem.newRamFileSystem
import static io.github.ascopes.jct.pathwrappers.RamDirectory.newRamDirectory
import static org.assertj.core.api.Assumptions.assumeThat

@DisplayName("Checkerframework Nullness acceptance tests")
Expand All @@ -43,9 +43,9 @@ class CheckerNullTest {
@DisplayName("Happy paths work as expected")
@Execution(ExecutionMode.CONCURRENT)
@JavacCompilerTest
void happyPathsWorkAsExpected(Compilable compiler) {
void happyPathsWorkAsExpected(Compiler compiler) {
// Given
def sources = newRamFileSystem("sources")
def sources = newRamDirectory("sources")
.createDirectory("org", "example")
.copyContentsFrom("src", "test", "resources", "code", "nullness", "happy")

Expand All @@ -63,9 +63,9 @@ class CheckerNullTest {
@DisplayName("Sad paths fail as expected")
@Execution(ExecutionMode.CONCURRENT)
@JavacCompilerTest
void sadPathsFailAsExpected(Compilable compiler) {
void sadPathsFailAsExpected(Compiler compiler) {
// Given
def sources = newRamFileSystem("sources")
def sources = newRamDirectory("sources")
.createDirectory("org", "example")
.copyContentsFrom("src", "test", "resources", "code", "nullness", "sad")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@
*/
package io.github.ascopes.jct.acceptancetests.dagger

import io.github.ascopes.jct.compilers.Compilable
import io.github.ascopes.jct.compilers.Compiler
import io.github.ascopes.jct.junit.JavacCompilerTest
import org.junit.jupiter.api.DisplayName

import static io.github.ascopes.jct.assertions.JctAssertions.assertThatCompilation
import static io.github.ascopes.jct.pathwrappers.RamFileSystem.newRamFileSystem
import static io.github.ascopes.jct.pathwrappers.RamDirectory.newRamDirectory

@DisplayName("Dagger acceptance tests")
class DaggerTest {
@DisplayName("Dagger DI runs as expected in the annotation processing phase")
@JavacCompilerTest
void daggerDiRunsAsExpectedInTheAnnotationProcessingPhase(Compilable compiler) {
void daggerDiRunsAsExpectedInTheAnnotationProcessingPhase(Compiler compiler) {
// Given
def sources = newRamFileSystem("sources")
def sources = newRamDirectory("sources")
.createDirectory("org", "example")
.copyContentsFrom("src", "test", "resources", "code")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package io.github.ascopes.jct.acceptancetests.immutables

import io.github.ascopes.jct.compilers.Compilable
import io.github.ascopes.jct.compilers.Compiler
import io.github.ascopes.jct.junit.JavacCompilerTest
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.parallel.Execution
Expand All @@ -24,7 +24,7 @@ import org.junit.jupiter.api.parallel.ExecutionMode
import javax.tools.StandardLocation

import static io.github.ascopes.jct.assertions.JctAssertions.assertThatCompilation
import static io.github.ascopes.jct.pathwrappers.RamFileSystem.newRamFileSystem
import static io.github.ascopes.jct.pathwrappers.RamDirectory.newRamDirectory
import static org.assertj.core.api.SoftAssertions.assertSoftly

/**
Expand All @@ -42,9 +42,9 @@ class ImmutablesIntegrationTest {
@DisplayName("Immutables @Value produces the expected class")
@Execution(ExecutionMode.CONCURRENT)
@JavacCompilerTest
void immutablesValueProducesTheExpectedClass(Compilable compiler) {
void immutablesValueProducesTheExpectedClass(Compiler compiler) {
// Given
def sources = newRamFileSystem("sources")
def sources = newRamDirectory("sources")
.rootDirectory()
.copyContentsFrom("src", "test", "resources", "code", "flat")

Expand Down Expand Up @@ -77,9 +77,9 @@ class ImmutablesIntegrationTest {
@DisplayName("Immutables @Value produces the expected class for modules")
@Execution(ExecutionMode.CONCURRENT)
@JavacCompilerTest(modules = true)
void immutablesValueProducesTheExpectedClassForModules(Compilable compiler) {
void immutablesValueProducesTheExpectedClassForModules(Compiler compiler) {
// Given
def sources = newRamFileSystem("sources")
def sources = newRamDirectory("sources")
.rootDirectory()
.copyContentsFrom("src", "test", "resources", "code", "jpms")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package io.github.ascopes.jct.acceptancetests.lombok

import io.github.ascopes.jct.compilers.Compilable
import io.github.ascopes.jct.compilers.Compiler
import io.github.ascopes.jct.junit.JavacCompilerTest
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.parallel.Execution
Expand All @@ -25,7 +25,7 @@ import javax.tools.StandardLocation
import java.nio.file.Path

import static io.github.ascopes.jct.assertions.JctAssertions.assertThatCompilation
import static io.github.ascopes.jct.pathwrappers.RamFileSystem.newRamFileSystem
import static io.github.ascopes.jct.pathwrappers.RamDirectory.newRamDirectory
import static org.assertj.core.api.SoftAssertions.assertSoftly

/**
Expand All @@ -43,9 +43,9 @@ class LombokIntegrationTest {
@DisplayName("Lombok @Data compiles the expected data class")
@Execution(ExecutionMode.CONCURRENT)
@JavacCompilerTest
void lombokDataCompilesTheExpectedDataClass(Compilable compiler) {
void lombokDataCompilesTheExpectedDataClass(Compiler compiler) {
// Given
def sources = newRamFileSystem("sources")
def sources = newRamDirectory("sources")
.rootDirectory()
.copyContentsFrom("src", "test", "resources", "code", "flat")

Expand Down Expand Up @@ -77,9 +77,9 @@ class LombokIntegrationTest {
@DisplayName("Lombok @Data compiles the expected data class with module support")
@Execution(ExecutionMode.CONCURRENT)
@JavacCompilerTest(modules = true)
void lombokDataCompilesTheExpectedDataClassWithModuleSupport(Compilable compiler) {
void lombokDataCompilesTheExpectedDataClassWithModuleSupport(Compiler compiler) {
// Given
def sources = newRamFileSystem("sources")
def sources = newRamDirectory("sources")
.rootDirectory()
.copyContentsFrom("src", "test", "resources", "code", "jpms")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
package io.github.ascopes.jct.acceptancetests.mapstruct

import io.github.ascopes.jct.compilers.Compilable
import io.github.ascopes.jct.compilers.Compiler
import io.github.ascopes.jct.junit.JavacCompilerTest
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.parallel.Execution
Expand All @@ -24,7 +24,7 @@ import org.junit.jupiter.api.parallel.ExecutionMode
import javax.tools.StandardLocation

import static io.github.ascopes.jct.assertions.JctAssertions.assertThatCompilation
import static io.github.ascopes.jct.pathwrappers.RamFileSystem.newRamFileSystem
import static io.github.ascopes.jct.pathwrappers.RamDirectory.newRamDirectory
import static org.assertj.core.api.SoftAssertions.assertSoftly

@DisplayName("MapStruct integration tests")
Expand All @@ -34,9 +34,9 @@ class MapStructIntegrationTest {
@DisplayName("MapStruct generates expected mapping code")
@Execution(ExecutionMode.CONCURRENT)
@JavacCompilerTest
void mapStructGeneratesExpectedMappingCode(Compilable compiler) {
void mapStructGeneratesExpectedMappingCode(Compiler compiler) {
// Given
def sources = newRamFileSystem("sources")
def sources = newRamDirectory("sources")
.rootDirectory()
.copyContentsFrom("src", "test", "resources", "code", "flat")

Expand Down Expand Up @@ -75,9 +75,9 @@ class MapStructIntegrationTest {
@DisplayName("MapStruct generates expected mapping code for modules")
@Execution(ExecutionMode.CONCURRENT)
@JavacCompilerTest(modules = true)
void mapStructGeneratesExpectedMappingCodeForModules(Compilable compiler) {
void mapStructGeneratesExpectedMappingCodeForModules(Compiler compiler) {
// Given
def sources = newRamFileSystem("sources")
def sources = newRamDirectory("sources")
.rootDirectory()
.copyContentsFrom("src", "test", "resources", "code", "jpms")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@
package io.github.ascopes.jct.acceptancetests.serviceloaderjpms.testing

import io.github.ascopes.jct.acceptancetests.serviceloaderjpms.ServiceProcessor
import io.github.ascopes.jct.compilers.Compilable
import io.github.ascopes.jct.compilers.Compiler
import io.github.ascopes.jct.junit.JavacCompilerTest
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.parallel.Execution
import org.junit.jupiter.api.parallel.ExecutionMode

import static io.github.ascopes.jct.assertions.JctAssertions.assertThatCompilation
import static io.github.ascopes.jct.pathwrappers.RamFileSystem.newRamFileSystem
import static io.github.ascopes.jct.pathwrappers.RamDirectory.newRamDirectory

@DisplayName("ServiceProcessor tests (JPMS)")
class ServiceProcessorTest {

@DisplayName("Expected files get created when the processor is run")
@Execution(ExecutionMode.CONCURRENT)
@JavacCompilerTest(modules = true)
void expectedFilesGetCreated(Compilable compiler) {
def sources = newRamFileSystem("sources")
void expectedFilesGetCreated(Compiler compiler) {
def sources = newRamDirectory("sources")
.createDirectory("org", "example")
.copyContentsFrom("src", "test", "resources", "code")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,23 +16,23 @@
package io.github.ascopes.jct.acceptancetests.serviceloader.testing

import io.github.ascopes.jct.acceptancetests.serviceloader.ServiceProcessor
import io.github.ascopes.jct.compilers.Compilable
import io.github.ascopes.jct.compilers.Compiler
import io.github.ascopes.jct.junit.JavacCompilerTest
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.parallel.Execution
import org.junit.jupiter.api.parallel.ExecutionMode

import static io.github.ascopes.jct.assertions.JctAssertions.assertThatCompilation
import static io.github.ascopes.jct.pathwrappers.RamFileSystem.newRamFileSystem
import static io.github.ascopes.jct.pathwrappers.RamDirectory.newRamDirectory

@DisplayName("ServiceProcessor tests (no JPMS)")
class ServiceProcessorTest {

@DisplayName("Expected files get created when the processor is run")
@Execution(ExecutionMode.CONCURRENT)
@JavacCompilerTest
void expectedFilesGetCreated(Compilable compiler) {
def sources = newRamFileSystem("sources")
void expectedFilesGetCreated(Compiler compiler) {
def sources = newRamDirectory("sources")
.createDirectory("org", "example")
.copyContentsFrom("src", "test", "resources", "code")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
*/
package io.github.ascopes.jct.acceptancetests.springcontextindexer

import io.github.ascopes.jct.compilers.Compilable
import io.github.ascopes.jct.compilers.Compiler
import io.github.ascopes.jct.junit.JavacCompilerTest
import org.junit.jupiter.api.DisplayName
import org.junit.jupiter.api.parallel.Execution
import org.junit.jupiter.api.parallel.ExecutionMode
import org.springframework.context.index.processor.CandidateComponentsIndexer

import static io.github.ascopes.jct.assertions.JctAssertions.assertThatCompilation
import static io.github.ascopes.jct.pathwrappers.RamFileSystem.newRamFileSystem
import static io.github.ascopes.jct.pathwrappers.RamDirectory.newRamDirectory

@DisplayName("Spring Context Indexer acceptance tests")
class SpringContextIndexerTest {
Expand All @@ -32,9 +32,9 @@ class SpringContextIndexerTest {
@DisplayName("Spring will index the application context as expected")
@Execution(ExecutionMode.CONCURRENT)
@JavacCompilerTest
void springWillIndexTheApplicationContextAsExpected(Compilable compiler) {
void springWillIndexTheApplicationContextAsExpected(Compiler compiler) {
// Given
def sources = newRamFileSystem("sources")
def sources = newRamDirectory("sources")
.createDirectory("org", "example")
.copyContentsFrom("src", "test", "resources", "code")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import io.github.ascopes.jct.annotations.Nullable;
import io.github.ascopes.jct.pathwrappers.PathWrapper;
import io.github.ascopes.jct.pathwrappers.TestDirectoryFactory;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
Expand Down Expand Up @@ -52,7 +53,7 @@
*/
@API(since = "0.0.1", status = Status.EXPERIMENTAL)
public abstract class AbstractCompiler<A extends AbstractCompiler<A>>
implements Compilable<A, CompilationImpl> {
implements Compiler<A, CompilationImpl> {

private final String name;
private final JavaCompiler jsr199Compiler;
Expand Down Expand Up @@ -98,19 +99,19 @@ protected AbstractCompiler(
compilerOptions = new ArrayList<>();
runtimeOptions = new ArrayList<>();

showWarnings = Compilable.DEFAULT_SHOW_WARNINGS;
showDeprecationWarnings = Compilable.DEFAULT_SHOW_DEPRECATION_WARNINGS;
failOnWarnings = Compilable.DEFAULT_FAIL_ON_WARNINGS;
locale = Compilable.DEFAULT_LOCALE;
logCharset = Compilable.DEFAULT_LOG_CHARSET;
previewFeatures = Compilable.DEFAULT_PREVIEW_FEATURES;
showWarnings = Compiler.DEFAULT_SHOW_WARNINGS;
showDeprecationWarnings = Compiler.DEFAULT_SHOW_DEPRECATION_WARNINGS;
failOnWarnings = Compiler.DEFAULT_FAIL_ON_WARNINGS;
locale = Compiler.DEFAULT_LOCALE;
logCharset = Compiler.DEFAULT_LOG_CHARSET;
previewFeatures = Compiler.DEFAULT_PREVIEW_FEATURES;

release = null;
source = null;
target = null;

verbose = Compilable.DEFAULT_VERBOSE;
diagnosticLoggingMode = Compilable.DEFAULT_DIAGNOSTIC_LOGGING_MODE;
verbose = Compiler.DEFAULT_VERBOSE;
diagnosticLoggingMode = Compiler.DEFAULT_DIAGNOSTIC_LOGGING_MODE;
}

/**
Expand Down Expand Up @@ -444,6 +445,17 @@ public A annotationProcessorDiscovery(AnnotationProcessorDiscovery annotationPro
return myself();
}

@Override
public TestDirectoryFactory getTestDirectoryFactory() {
return fileManagerBuilder.getTestDirectoryFactory();
}

@Override
public A testDirectoryFactory(TestDirectoryFactory testDirectoryFactory) {
fileManagerBuilder.setTestDirectoryFactory(testDirectoryFactory);
return myself();
}

@Override
public final String toString() {
return name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
* @since 0.0.1
*/
@API(since = "0.0.1", status = Status.EXPERIMENTAL)
public class CompilationFactory<A extends Compilable<A, CompilationImpl>> {
public class CompilationFactory<A extends Compiler<A, CompilationImpl>> {

private static final Logger LOGGER = LoggerFactory.getLogger(CompilationFactory.class);

Expand Down Expand Up @@ -211,8 +211,8 @@ protected List<String> buildFlags(A compiler, FlagBuilder flagBuilder) {
* Build the {@link JavaFileManager} to use.
*
* <p>LoggingMode will be applied to this via
* {@link #applyLoggingToFileManager(Compilable, FileManager)}, which will be handled by
* {@link #compile(Compilable, FileManagerBuilder, JavaCompiler, FlagBuilder)}.
* {@link #applyLoggingToFileManager(Compiler, FileManager)}, which will be handled by
* {@link #compile(Compiler, FileManagerBuilder, JavaCompiler, FlagBuilder)}.
*
* @param compiler the compiler to use.
* @return the file manager to use.
Expand Down Expand Up @@ -269,10 +269,10 @@ protected List<? extends JavaFileObject> findCompilationUnits(

/**
* Apply the logging level to the file manager provided by
* {@link #buildFileManager(Compilable, FileManagerBuilder)}.
* {@link #buildFileManager(Compiler, FileManagerBuilder)}.
*
* <p>The default implementation will wrap the given {@link JavaFileManager} in a
* {@link LoggingFileManagerProxy} if the {@link Compilable#getFileManagerLoggingMode()} field is
* {@link LoggingFileManagerProxy} if the {@link Compiler#getFileManagerLoggingMode()} field is
* <strong>not</strong> set to {@link LoggingMode#DISABLED}. In the latter scenario, the input
* will be returned to the caller with no other modifications.
*
Expand Down
Loading