<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>io.jenkins.blueocean</groupId>
    <artifactId>blueocean-parent</artifactId>
    <version>1.3.0-beta-2</version>
  </parent>

  <artifactId>blueocean-rest</artifactId>
  <packaging>hpi</packaging>

  <name>REST API for Blue Ocean</name>
  <url>https://wiki.jenkins-ci.org/display/JENKINS/Blue+Ocean+Plugin</url>

  <dependencies>
      <dependency>
          <groupId>${project.groupId}</groupId>
          <artifactId>blueocean-commons</artifactId>
      </dependency>
      <dependency>
          <groupId>io.jenkins.blueocean.rest.annotation</groupId>
          <artifactId>capability-annotation</artifactId>
      </dependency>
  </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-enforcer-plugin</artifactId>
                <dependencies>
                    <dependency>
                        <groupId>de.skuzzle.enforcer</groupId>
                        <artifactId>restrict-imports-enforcer-rule</artifactId>
                        <version>0.7.0</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <id>check-no-jenkins-imports</id>
                        <phase>process-sources</phase>
                        <goals>
                            <goal>enforce</goal>
                        </goals>
                        <configuration>
                            <rules>
                                <!-- All packages can use Extension points -->
                                <restrictImports implementation="de.skuzzle.enforcer.restrictimports.RestrictImports">
                                    <basePackage>**</basePackage>
                                    <bannedImports>
                                        <bannedImport>jenkins.**</bannedImport>
                                        <bannedImport>hudson.**</bannedImport>
                                    </bannedImports>
                                    <allowedImports>
                                        <allowedImport>hudson.Extension</allowedImport>
                                        <allowedImport>hudson.ExtensionPoint</allowedImport>
                                        <allowedImport>hudson.ExtensionList</allowedImport>
                                        <allowedImport>hudson.ExtensionListListener</allowedImport>
                                        <allowedImport>hudson.security.csrf.CrumbExclusion</allowedImport>
                                        <allowedImport>hudson.util.AdaptedIterator</allowedImport>
                                        <allowedImport>hudson.Util</allowedImport>
                                    </allowedImports>
                                    <excludedClasses>
                                        <excludedClass>io.jenkins.blueocean.rest.factory.**</excludedClass>
                                    </excludedClasses>
                                </restrictImports>
                                <!-- Factory package is allowed to import Jenkins models -->
                                <restrictImports implementation="de.skuzzle.enforcer.restrictimports.RestrictImports">
                                    <basePackage>io.jenkins.blueocean.rest.factory.**</basePackage>
                                    <bannedImports>
                                        <bannedImport>jenkins.**</bannedImport>
                                        <bannedImport>hudson.**</bannedImport>
                                    </bannedImports>
                                    <allowedImports>
                                        <allowedImport>hudson.model.RootAction</allowedImport>
                                        <allowedImport>hudson.model.Action</allowedImport>
                                        <allowedImport>hudson.model.ModelObject</allowedImport>
                                        <allowedImport>hudson.Extension</allowedImport>
                                        <allowedImport>hudson.ExtensionPoint</allowedImport>
                                        <allowedImport>hudson.ExtensionList</allowedImport>
                                        <allowedImport>hudson.model.Item</allowedImport>
                                        <allowedImport>hudson.model.ItemGroup</allowedImport>
                                        <allowedImport>jenkins.model.ModifiableTopLevelItemGroup</allowedImport>
                                        <allowedImport>hudson.model.TopLevelItem</allowedImport>
                                        <allowedImport>jenkins.model.Jenkins</allowedImport>
                                        <allowedImport>hudson.Util</allowedImport>
                                        <allowedImport>hudson.model.Run</allowedImport>
                                        <allowedImport>hudson.model.Job</allowedImport>
                                        <allowedImport>hudson.scm.ChangeLogSet</allowedImport>
                                    </allowedImports>
                                </restrictImports>
                                <restrictImports implementation="de.skuzzle.enforcer.restrictimports.RestrictImports">
                                    <basePackage>io.jenkins.blueocean.rest.analytics.**</basePackage>
                                    <bannedImports>
                                        <bannedImport>jenkins.**</bannedImport>
                                        <bannedImport>hudson.**</bannedImport>
                                    </bannedImports>
                                    <allowedImports>
                                        <allowedImport>hudson.Extension</allowedImport>
                                        <allowedImport>hudson.ExtensionPoint</allowedImport>
                                        <allowedImport>hudson.ExtensionList</allowedImport>
                                    </allowedImports>
                                </restrictImports>
                            </rules>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
