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      @Nullable
62      MultiModule getMultiModule();
63  
64      String isProcessPlugins();
65  
66      String getDefaultGlob();
67  
68      @Nonnull
69      List<Include> getGlobalIncludePaths();
70  
71      @Nonnull
72      List<Exclude> getGlobalExcludePaths();
73  
74      @Nonnull
75      PluginScanConfig getPluginDirScanConfig(Plugin plugin);
76  
77      @Nonnull
78      PluginScanConfig getExecutionDirScanConfig(Plugin plugin, PluginExecution exec);
79  
80      @Nonnull
81      HashFactory getHashFactory();
82  
83      boolean isForcedExecution(MojoExecution execution);
84  
85      String getId();
86  
87      String getUrl();
88  
89      String getTransport();
90  
91      boolean isEnabled();
92  
93      boolean isRemoteCacheEnabled();
94  
95      boolean isSaveToRemote();
96  
97      boolean isSaveToRemoteFinal();
98  
99      boolean isSkipCache();
100 
101     boolean isFailFast();
102 
103     int getMaxLocalBuildsCached();
104 
105     String getLocalRepositoryLocation();
106 
107     List<DirName> getAttachedOutputs();
108 
109     boolean adjustMetaInfVersion();
110 
111     boolean calculateProjectVersionChecksum();
112 
113     boolean canIgnore(MojoExecution mojoExecution);
114 
115     @Nonnull
116     List<Pattern> getExcludePatterns();
117 
118     boolean isBaselineDiffEnabled();
119 
120     String getBaselineCacheUrl();
121 
122     /**
123      * Artifacts restore policy. Eager policy (default) resolves all cached artifacts before restoring project and
124      * allows safe to fallback ro normal execution in case of restore failure. Lazy policy restores artifacts on demand
125      * minimizing need for downloading any artifacts from cache
126      * <p>
127      * Use: -Dmaven.build.cache.lazyRestore=(true|false)
128      */
129     boolean isLazyRestore();
130 
131     /**
132      * Flag to restore (default) or not generated sources as it might be desired to disable it in continuous integration
133      * scenarios
134      */
135     boolean isRestoreGeneratedSources();
136 
137     /**
138      * Flag to restore (default) or not generated artifacts
139      */
140     boolean isRestoreOnDiskArtifacts();
141 
142     String getAlwaysRunPlugins();
143 
144     /**
145      * Flag to disable cache saving
146      */
147     boolean isSkipSave();
148 
149     /**
150      * Flag to save in cache only if a build went through the clean lifecycle
151      */
152     boolean isMandatoryClean();
153 }