From af182d58d83111988fd923579d9b74781acda19b Mon Sep 17 00:00:00 2001 From: Andrew Churilo Date: Mon, 12 Apr 2021 13:57:34 +0300 Subject: [PATCH] Add missed files Files copied from: https://android.googlesource.com/platform/tools/base --- .gitignore | 3 +- .../java/com/android/build/FilterData.java | 32 ++++++ .../java/com/android/build/OutputFile.java | 39 +++++++ .../java/com/android/build/VariantOutput.java | 101 ++++++++++++++++++ 4 files changed, 174 insertions(+), 1 deletion(-) create mode 100644 aosp/builder-model/src/main/java/com/android/build/FilterData.java create mode 100644 aosp/builder-model/src/main/java/com/android/build/OutputFile.java create mode 100644 aosp/builder-model/src/main/java/com/android/build/VariantOutput.java diff --git a/.gitignore b/.gitignore index 7741c2ee1..198e402a0 100644 --- a/.gitignore +++ b/.gitignore @@ -17,6 +17,7 @@ out/ # Gradle files .gradle/ build/ +!aosp/builder-model/src/main/java/com/android/build # Local configuration file (sdk path, etc) local.properties @@ -64,4 +65,4 @@ freeline_project_description.json !/lib-android-compiler/src/main/java/com/android/build/ !/aosp/gradle-experimental/src/main/java/com/android/build/ /txt.java -!**/src/* \ No newline at end of file +!**/src/* diff --git a/aosp/builder-model/src/main/java/com/android/build/FilterData.java b/aosp/builder-model/src/main/java/com/android/build/FilterData.java new file mode 100644 index 000000000..f0684fc54 --- /dev/null +++ b/aosp/builder-model/src/main/java/com/android/build/FilterData.java @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.build; + +import com.android.annotations.NonNull; + +/** + * Represents a split information, like its type or dimension (density, abi, language...) and + * the filter value (like hdpi for a density split type). + */ +public interface FilterData { + + @NonNull + String getIdentifier(); + + @NonNull + String getFilterType(); +} diff --git a/aosp/builder-model/src/main/java/com/android/build/OutputFile.java b/aosp/builder-model/src/main/java/com/android/build/OutputFile.java new file mode 100644 index 000000000..24f36976b --- /dev/null +++ b/aosp/builder-model/src/main/java/com/android/build/OutputFile.java @@ -0,0 +1,39 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.build; + +import com.android.annotations.NonNull; + +import java.io.File; + +/** An output with an associated set of filters. */ +@Deprecated +public interface OutputFile extends VariantOutput { + + /** + * Returns the output file for this artifact's output. + * Depending on whether the project is an app or a library project, this could be an apk or + * an aar file. If this {@link OutputFile} has filters, this is a split + * APK. + * + * For test artifact for a library project, this would also be an apk. + * + * @return the output file. + */ + @NonNull + File getOutputFile(); +} diff --git a/aosp/builder-model/src/main/java/com/android/build/VariantOutput.java b/aosp/builder-model/src/main/java/com/android/build/VariantOutput.java new file mode 100644 index 000000000..2adf384ee --- /dev/null +++ b/aosp/builder-model/src/main/java/com/android/build/VariantOutput.java @@ -0,0 +1,101 @@ +/* + * Copyright (C) 2014 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.build; + +import com.android.annotations.NonNull; + +import java.util.Collection; + +/** basic variant output information */ +@Deprecated +public interface VariantOutput { + + /** An object representing the lack of filter. */ + String NO_FILTER = null; + + /** + * Type of package file, either the main APK or a full split APK file containing resources for a + * particular split dimension. + */ + enum OutputType { + MAIN, + FULL_SPLIT + } + + /** + * String representation of the OutputType enum which can be used for remote-able interfaces. + */ + String MAIN = OutputType.MAIN.name(); + + String FULL_SPLIT = OutputType.FULL_SPLIT.name(); + + /** Split dimension type */ + enum FilterType { + DENSITY, + ABI, + LANGUAGE + } + + /** + * String representations of the FilterType enum which can be used for remote-able interfaces.Ap + */ + String DENSITY = FilterType.DENSITY.name(); + + String ABI = FilterType.ABI.name(); + String LANGUAGE = FilterType.LANGUAGE.name(); + + /** Returns the output type of the referenced APK. */ + @NonNull + String getOutputType(); + + /** + * Returns the split dimensions the referenced APK was created with. Each collection's value is + * the string representation of an element of the {@link FilterType} enum. + */ + @NonNull + Collection getFilterTypes(); + + /** Returns all the split information used to create the APK. */ + @NonNull + Collection getFilters(); + + /** + * Returns the main file for this artifact which can be either the {@link + * OutputType#MAIN} or {@link + * OutputType#FULL_SPLIT} + */ + @NonNull + OutputFile getMainOutputFile(); + + /** + * All the output files for this artifacts, contains the main APK and optionally a list of split + * APKs. + */ + @NonNull + @Deprecated + Collection getOutputs(); + + /** + * Returns the version code for this output. + * + *

This is convenient method that returns the final version code whether it's coming from the + * override set in the output or from the variant's merged flavor. + * + * @return the version code. + */ + int getVersionCode(); +}