View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.maven.buildcache.xml;
20  
21  import javax.annotation.Nonnull;
22  import javax.annotation.Nullable;
23  
24  import java.util.List;
25  import java.util.regex.Pattern;
26  
27  import org.apache.maven.buildcache.PluginScanConfig;
28  import org.apache.maven.buildcache.hash.HashFactory;
29  import org.apache.maven.buildcache.xml.config.Exclude;
30  import org.apache.maven.buildcache.xml.config.Include;
31  import org.apache.maven.buildcache.xml.config.MultiModule;
32  import org.apache.maven.buildcache.xml.config.PropertyName;
33  import org.apache.maven.buildcache.xml.config.TrackedProperty;
34  import org.apache.maven.model.Plugin;
35  import org.apache.maven.model.PluginExecution;
36  import org.apache.maven.plugin.MojoExecution;
37  
38  /**
39   * A java interface to the information configured in the maven-build-cache-config.xml file
40   */
41  public interface CacheConfig {
42  
43      @Nonnull
44      CacheState initialize();
45  
46      @Nonnull
47      List<TrackedProperty> getTrackedProperties(MojoExecution mojoExecution);
48  
49      boolean isLogAllProperties(MojoExecution mojoExecution);
50  
51      @Nonnull
52      List<PropertyName> getLoggedProperties(MojoExecution mojoExecution);
53  
54      @Nonnull
55      List<PropertyName> getNologProperties(MojoExecution mojoExecution);
56  
57      @Nonnull
58      List<String> getEffectivePomExcludeProperties(Plugin plugin);
59  
60      @Nullable
61      MultiModule getMultiModule();
62  
63      String isProcessPlugins();
64  
65      String getDefaultGlob();
66  
67      @Nonnull
68      List<Include> getGlobalIncludePaths();
69  
70      @Nonnull
71      List<Exclude> getGlobalExcludePaths();
72  
73      @Nonnull
74      PluginScanConfig getPluginDirScanConfig(Plugin plugin);
75  
76      @Nonnull
77      PluginScanConfig getExecutionDirScanConfig(Plugin plugin, PluginExecution exec);
78  
79      @Nonnull
80      HashFactory getHashFactory();
81  
82      boolean isForcedExecution(MojoExecution execution);
83  
84      String getId();
85  
86      String getUrl();
87  
88      String getTransport();
89  
90      boolean isEnabled();
91  
92      boolean isRemoteCacheEnabled();
93  
94      boolean isSaveToRemote();
95  
96      boolean isSaveToRemoteFinal();
97  
98      boolean isSkipCache();
99  
100     boolean isFailFast();
101 
102     int getMaxLocalBuildsCached();
103 
104     String getLocalRepositoryLocation();
105 
106     List<String> getAttachedOutputs();
107 
108     boolean adjustMetaInfVersion();
109 
110     boolean canIgnore(MojoExecution mojoExecution);
111 
112     @Nonnull
113     List<Pattern> getExcludePatterns();
114 
115     boolean isBaselineDiffEnabled();
116 
117     String getBaselineCacheUrl();
118 
119     /**
120      * Artifacts restore policy. Eager policy (default) resolves all cached artifacts before restoring project and
121      * allows safe to fallback ro normal execution in case of restore failure. Lazy policy restores artifacts on demand
122      * minimizing need for downloading any artifacts from cache
123      * <p>
124      * Use: -Dmaven.build.cache.lazyRestore=(true|false)
125      */
126     boolean isLazyRestore();
127 
128     /**
129      * Flag to restore (default) or not generated sources as it might be desired to disable it in continuous integration
130      * scenarios
131      */
132     boolean isRestoreGeneratedSources();
133 
134     String getAlwaysRunPlugins();
135 }