Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/maven/org.apache.maven.plugins-ma…
Browse files Browse the repository at this point in the history
…ven-compiler-plugin-3.13.0
  • Loading branch information
sigpwned authored Jan 16, 2025
2 parents 9668fea + 4fc4db9 commit 7fb4db1
Show file tree
Hide file tree
Showing 169 changed files with 20,201 additions and 3,430 deletions.
114 changes: 99 additions & 15 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
<connection>scm:git:ssh://[email protected]/sigpwned/rapier.git</connection>
<developerConnection>scm:git:ssh://[email protected]/sigpwned/rapier.git</developerConnection>
<url>https://github.com/sigpwned/rapier/tree/main</url>
<tag>v70.1.0</tag>
</scm>

<licenses>
Expand All @@ -52,7 +51,14 @@
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.release>11</maven.compiler.release>

<!-- These versions are injected into tests, so all attempts to -->
<!-- control versions of these dependencies must be done here. -->
<dagger.version>2.54</dagger.version>
<javax.inject.version>1</javax.inject.version>
<jakarta.inject-api.version>2.0.1</jakarta.inject-api.version>
<jsr305.version>3.0.2</jsr305.version>
<awssdk.version>2.29.43</awssdk.version>
</properties>

<build>
Expand All @@ -63,23 +69,71 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.2</version>
<configuration>
<!-- The below is required for testing annotation processors -->
<!-- using com.google.testing.compile:compile-testing. -->
<!--
-XX:+EnableDynamicAgentLoading is to suppress a
Mockito self-attach warning when running tests
-->
<!--
-Xshare:off is to suppress some warnings from
Mockito when mocking Object methods during tests
-->
<!--
The "add exports" flags below below are required for
testing annotation processors using
com.google.testing.compile:compile-testing in
Java 9+.
-->
<argLine>
--add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
--add-exports jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
--add-opens jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
-XX:+EnableDynamicAgentLoading
-Xshare:off
--add-exports
jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
--add-opens
jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED
--add-exports
jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
--add-opens
jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
--add-exports
jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
--add-opens
jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED
</argLine>
<systemPropertyVariables>
<maven.dagger.version>${dagger.version}</maven.dagger.version>
<maven.javax.inject.version>${javax.inject.version}</maven.javax.inject.version>
<maven.jakarta.inject-api.version>${jakarta.inject-api.version}</maven.jakarta.inject-api.version>
<maven.jsr305.version>${jsr305.version}</maven.jsr305.version>
<maven.awssdk.version>${awssdk.version}</maven.awssdk.version>
<maven.project.basedir>${project.basedir}</maven.project.basedir>
</systemPropertyVariables>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.2</version>
</plugin>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.3.1</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.6.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.6.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>templating-maven-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
Expand Down Expand Up @@ -177,7 +231,7 @@
<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>bom</artifactId>
<version>2.29.43</version>
<version>${awssdk.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand All @@ -195,6 +249,13 @@
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-bom</artifactId>
<version>5.15.2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.google.dagger</groupId>
<artifactId>dagger</artifactId>
Expand All @@ -205,6 +266,22 @@
<artifactId>dagger-compiler</artifactId>
<version>${dagger.version}</version>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>${javax.inject.version}</version>
</dependency>
<dependency>
<groupId>jakarta.inject</groupId>
<artifactId>jakarta.inject-api</artifactId>
<version>${jakarta.inject-api.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.findbugs</groupId>
<artifactId>jsr305</artifactId>
<version>${jsr305.version}</version>
</dependency>

<dependency>
<groupId>com.google.testing.compile</groupId>
<artifactId>compile-testing</artifactId>
Expand All @@ -215,9 +292,16 @@

<modules>
<module>rapier-core</module>
<module>rapier-processor-environment-variable</module>
<module>rapier-processor-system-property</module>
<module>rapier-processor-aws-ssm</module>
<module>rapier-processor-cli</module>
<module>rapier-compiler-core</module>
<module>rapier-assumptions-tests</module>
<module>rapier-environment-variable</module>
<module>rapier-environment-variable-compiler</module>
<module>rapier-system-property</module>
<module>rapier-system-property-compiler</module>
<module>rapier-cli</module>
<module>rapier-cli-compiler</module>
<module>rapier-aws-ssm</module>
<module>rapier-aws-ssm-compiler</module>
<module>rapier-example</module>
</modules>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,29 @@
<version>0.0.0-b0-SNAPSHOT</version>
</parent>

<artifactId>rapier-processor-cli</artifactId>
<name>rapier-processor-cli</name>
<artifactId>rapier-assumptions-tests</artifactId>
<name>rapier-assumptions-tests</name>
<packaging>jar</packaging>

<dependencies>
<dependency>
<groupId>com.sigpwned</groupId>
<artifactId>rapier-core</artifactId>
<artifactId>rapier-compiler-core</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>com.google.dagger</groupId>
<artifactId>dagger-compiler</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sigpwned</groupId>
<artifactId>rapier-core</artifactId>
<artifactId>rapier-compiler-core</artifactId>
<version>${project.version}</version>
<type>test-jar</type>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.dagger</groupId>
<artifactId>dagger-compiler</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.testing.compile</groupId>
<artifactId>compile-testing</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@
* limitations under the License.
* ==================================LICENSE_END===================================
*/
package rapier.core.assumptions.dagger;
package rapier.assumptions.dagger;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrowsExactly;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.io.IOException;
import javax.inject.Provider;
import org.junit.jupiter.api.Test;
import rapier.core.DaggerTestBase;

/**
* Test assumptions about how {@link Provider} bindings work in Dagger.
Expand Down Expand Up @@ -66,6 +66,8 @@ public Integer provideInteger() {
final String errors = compileSourceCode(componentSourceCode, moduleSourceCode);

assertTrue(errors.isBlank(), "Expected no errors, but errors were found.");

// TODO After we refactor DaggerTestBase, verify no warnings here
}

/**
Expand Down Expand Up @@ -188,4 +190,51 @@ public static void main(String[] args) {
assertThrowsExactly(NullPointerException.class,
() -> compileAndRunSourceCode(componentSourceCode, moduleSourceCode, appSourceCode));
}


/**
* Verify that Dagger will satisfy a primitve dependency with a binding of its boxed equivalent
*/
@Test
public void givenIntDependencyAndIntegerBinding_whenCompileAndRun_thenNullError()
throws IOException {
final String componentSourceCode = """
import dagger.Component;
import javax.inject.Provider;
import javax.annotation.Nullable;
@Component(modules={ExampleModule.class})
public interface ExampleComponent {
public int provisionInt();
}
""";

final String moduleSourceCode = """
import dagger.Module;
import dagger.Provides;
import javax.annotation.Nullable;
@Module
public class ExampleModule {
@Provides
public Integer provideInteger() {
return 123;
}
}
""";

final String appSourceCode = """
public class ExampleApp {
public static void main(String[] args) {
ExampleComponent c = DaggerExampleComponent.builder().build();
System.out.println(c.provisionInt());
}
}
""";

final String output =
compileAndRunSourceCode(componentSourceCode, moduleSourceCode, appSourceCode).trim();

assertEquals(output, "123");
}
}
Loading

0 comments on commit 7fb4db1

Please sign in to comment.