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.DirName;
30  import org.apache.maven.buildcache.xml.config.Exclude;
31  import org.apache.maven.buildcache.xml.config.Include;
32  import org.apache.maven.buildcache.xml.config.MultiModule;
33  import org.apache.maven.buildcache.xml.config.PropertyName;
34  import org.apache.maven.buildcache.xml.config.TrackedProperty;
35  import org.apache.maven.model.Plugin;
36  import org.apache.maven.model.PluginExecution;
37  import org.apache.maven.plugin.MojoExecution;
38  
39  /**
40   * A java interface to the information configured in the maven-build-cache-config.xml file
41   */
42  public interface CacheConfig {
43  
44      @Nonnull
45      CacheState initialize();
46  
47      @Nonnull
48      List<TrackedProperty> getTrackedProperties(MojoExecution mojoExecution);
49  
50      boolean isLogAllProperties(MojoExecution mojoExecution);
51  
52      @Nonnull
53      List<PropertyName> getLoggedProperties(MojoExecution mojoExecution);
54  
55      @Nonnull
56      List<PropertyName> getNologProperties(MojoExecution mojoExecution);
57  
58      @Nonnull
59      List<String> getEffectivePomExcludeProperties(Plugin plugin);
60  
61      boolean isPluginDependenciesExcluded(Plugin plugin);
62  
63      @Nullable
64      MultiModule getMultiModule();
65  
66      String isProcessPlugins();
67  
68      String getDefaultGlob();
69  
70      @Nonnull
71      List<Include> getGlobalIncludePaths();
72  
73      @Nonnull
74      List<Exclude> getGlobalExcludePaths();
75  
76      @Nonnull
77      PluginScanConfig getPluginDirScanConfig(Plugin plugin);
78  
79      @Nonnull
80      PluginScanConfig getExecutionDirScanConfig(Plugin plugin, PluginExecution exec);
81  
82      @Nonnull
83      HashFactory getHashFactory();
84  
85      boolean isForcedExecution(MojoExecution execution);
86  
87      String getId();
88  
89      String getUrl();
90  
91      String getTransport();
92  
93      boolean isEnabled();
94  
95      boolean isRemoteCacheEnabled();
96  
97      boolean isSaveToRemote();
98  
99      boolean isSaveToRemoteFinal();
100 
101     boolean isSkipCache();
102 
103     boolean isFailFast();
104 
105     int getMaxLocalBuildsCached();
106 
107     String getLocalRepositoryLocation();
108 
109     List<DirName> getAttachedOutputs();
110 
111     boolean isPreservePermissions();
112 
113     boolean adjustMetaInfVersion();
114 
115     boolean calculateProjectVersionChecksum();
116 
117     boolean canIgnore(MojoExecution mojoExecution);
118 
119     @Nonnull
120     List<Pattern> getExcludePatterns();
121 
122     boolean isBaselineDiffEnabled();
123 
124     String getBaselineCacheUrl();
125 
126     /**
127      * Artifacts restore policy. Eager policy (default) resolves all cached artifacts before restoring project and
128      * allows safe to fallback ro normal execution in case of restore failure. Lazy policy restores artifacts on demand
129      * minimizing need for downloading any artifacts from cache
130      * <p>
131      * Use: -Dmaven.build.cache.lazyRestore=(true|false)
132      */
133     boolean isLazyRestore();
134 
135     /**
136      * Flag to restore (default) or not generated sources as it might be desired to disable it in continuous integration
137      * scenarios
138      */
139     boolean isRestoreGeneratedSources();
140 
141     /**
142      * Flag to restore (default) or not generated artifacts
143      */
144     boolean isRestoreOnDiskArtifacts();
145 
146     String getAlwaysRunPlugins();
147 
148     /**
149      * Flag to disable cache saving
150      */
151     boolean isSkipSave();
152 
153     /**
154      * Flag to save in cache only if a build went through the clean lifecycle
155      */
156     boolean isMandatoryClean();
157 }