Home | History | Annotate | Download | only in builders
      1 /*
      2  * Copyright (C) 2012 The Android Open Source Project
      3  *
      4  * Licensed under the Eclipse Public License, Version 1.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.eclipse.org/org/documents/epl-v10.php
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.ide.eclipse.adt.internal.build.builders;
     18 
     19 import com.android.annotations.NonNull;
     20 import com.android.sdklib.build.ApkBuilder;
     21 
     22 import org.eclipse.core.runtime.IPath;
     23 
     24 /**
     25  * Custom {@link ChangedFileSet} for java resources.
     26  *
     27  * This builds the set of inputs to be all the source folders of the given project,
     28  * and excludes files that won't be packaged.
     29  * This exclusion can't be easily described as a glob-pattern so it's overriding the default
     30  * behavior instead.
     31  *
     32  */
     33 class JavaResChangedSet extends ChangedFileSet {
     34 
     35     JavaResChangedSet(String logName, String... inputs) {
     36         super(logName, inputs);
     37     }
     38 
     39     @Override
     40     public boolean isInput(@NonNull String path, @NonNull IPath iPath) {
     41         if (!ApkBuilder.checkFileForPackaging(iPath.lastSegment(), iPath.getFileExtension())) {
     42             return false;
     43         }
     44         return super.isInput(path, iPath);
     45     }
     46 }
     47