Skip to content

Commit

Permalink
moved takari-builder into incrementalbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
Jaime committed May 11, 2017
1 parent 28a6b40 commit 96519f8
Show file tree
Hide file tree
Showing 270 changed files with 26,775 additions and 273 deletions.
1,056 changes: 1,056 additions & 0 deletions DOCUMENTATION.md

Large diffs are not rendered by default.

39 changes: 39 additions & 0 deletions MAVEN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## Builder Classloading

[Takari Maven Classloading](http://takari.io/book/91-maven-classloading.html) document provides an overview of classloaders created during Maven build and how these classloaders are wired together.


### The Pieces Of The Puzzle

Java SecurityManager extension/composition API must be shared by all Build Extensions and Maven Plugins used in the same JVM.

Modularity Enforcer must be able to "wrap" individual subproject builds, which implies it must be loaded either as Maven Core Extension or Build Extension. Modularity Enforcer depends on the composable security manager.

Although not a hard requirement, it is desired to use shared Builder Framework classes. Shared classes will make overall build analysis and enforment (e.g., input-output cycle detection) easier to implement. It is also better aligned with "builder runtime" vision (as opposed to "builder library") and will force us to provide strong API and runtime compatibility from the get-go. Builder Framework depends on the composable security manager.

Maven Plugins are loaded in separate classloaders. The plugins depend on Builder Framework.

exec-maven-plugin needs to access Modularity Enforcer classes. The plan is to remove the plugin after everything is converted to the Builder Framework, but this is not a hard requirement.

Although not immediately needed, surefire-maven-plugin support will require Builder Framework support external JVM fork. This will require surefire plugin access to Builder Framework classes.

### Proposed classloader configuration

Load SecurityManager, Modularity Enforcer and Builder Framework as single Maven Build Extension. In practical terms, this means that **all** Maven projects that use the Builder Framework will need to add the following `<plugin>` element in their parent pom:

```xml
<plugin>
<groupId>io.takari.builder</groupId>
<artifactId>takari-builder</artifactId>
<version>${takari-builder.version}</version>
<extensions>true</extensions>
</plugin>
```

The build extension will export SecurityManager, Modularity Enforcer and Builder Framework API packages and artifacts. This will ensure that all plugins used by the build will use the same classes from the build extension.



### Eclipse complicates things... or maybe not

As of version 1.7, Eclipse/m2e does not have concept of "reactor build" and all workspace projects are treated independently. There are still workspace-level plugin and extension realm caches, so "equal" build extensions are only loaded by single shared classloader. There are no reactor-build callbacks, but this will be a problem regardless of classloader arrangement.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[![Build Status](https://drone-butc.dci.sfdc.net/api/badges/modularization-team/io.takari.incrementalbuild/status.svg)](https://drone-butc.dci.sfdc.net/modularization-team/io.takari.incrementalbuild)

## Documentation

Click [here](DOCUMENTATION.md) for our user documentation.

## Release Instructions

mvn release:prepare release:perform

6 changes: 3 additions & 3 deletions incrementalbuild-its/.settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.compiler.source=1.8
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16|5|48
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=16|-1|16
Expand Down
5 changes: 0 additions & 5 deletions incrementalbuild-its/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,28 +13,23 @@
<dependency>
<groupId>io.takari</groupId>
<artifactId>incrementalbuild</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>io.takari.maven.plugins</groupId>
<artifactId>takari-plugin-testing</artifactId>
<version>${plugin-testing.version}</version>
</dependency>
<dependency>
<groupId>io.takari.maven.plugins</groupId>
<artifactId>takari-plugin-integration-testing</artifactId>
<version>${plugin-testing.version}</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0.20</version>
</dependency>
</dependencies>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import io.takari.maven.testing.executor.junit.MavenJUnitTestRunner;

@RunWith(MavenJUnitTestRunner.class)
@MavenVersions({"3.2.3", "3.2.5", "3.3.1", "3.3.9"})
@MavenVersions({"3.2.5", "3.3.1", "3.3.9"})
public class MavenIncrementalBuildTest {

@Rule
Expand Down Expand Up @@ -56,11 +56,15 @@ public void testBuildExtension() throws Exception {
verifier.forProject(new File(basedir, "plugin")).execute("install").assertErrorFreeLog();

//
verifier.forProject(new File(basedir, "project")).execute("compile").assertErrorFreeLog();
verifier.forProject(new File(basedir, "project")) //
.withCliOption("-X") //
.execute("compile").assertErrorFreeLog();
TestResources.assertFilesPresent(basedir, "project/target/output.txt");

// build extension should be optional
verifier.forProject(new File(basedir, "project-noextension")).execute("compile")
verifier.forProject(new File(basedir, "project-noextension")) //
.withCliOption("-X") //
.execute("compile") //
.assertErrorFreeLog();
TestResources.assertFilesPresent(basedir, "project-noextension/target/output.txt");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.2</version>
<version>3.4</version>
<configuration>
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.2</version>
<version>3.4</version>
<configuration>
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
Expand Down
4 changes: 2 additions & 2 deletions incrementalbuild-its/src/test/projects/test-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.2</version>
<version>3.4</version>
<scope>provided</scope>
</dependency>

Expand All @@ -34,7 +34,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.2</version>
<version>3.4</version>
<configuration>
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
Expand Down
Loading

0 comments on commit 96519f8

Please sign in to comment.