diff options
author | Xavier Ducrohet <xav@android.com> | 2013-03-27 08:51:14 -0700 |
---|---|---|
committer | Xavier Ducrohet <xav@android.com> | 2013-04-04 17:06:44 -0700 |
commit | 5894d6b0a48611186d8630a14f66f5e12c76af18 (patch) | |
tree | b1ea8c35700663a607737c657b2ae555e6634705 /builder-model | |
parent | 76f39918c349cefb7898215454a18a0e09d06659 (diff) | |
download | build-5894d6b0a48611186d8630a14f66f5e12c76af18.tar.gz |
New module for the model.
This model will be shared between the plugin and the IDE.
Change-Id: Ia521ed8d6f47301545679334157ea2ed8629bbb1
Diffstat (limited to 'builder-model')
5 files changed, 237 insertions, 0 deletions
diff --git a/builder-model/build.gradle b/builder-model/build.gradle new file mode 100644 index 0000000..c36c645 --- /dev/null +++ b/builder-model/build.gradle @@ -0,0 +1,52 @@ +apply plugin: 'java' +apply plugin: 'maven' +apply plugin: 'signing' + +dependencies { + compile "com.android.tools:common:$project.ext.baseAndroidVersion" +} + +def getVersion() { + if (project.has("release")) { + return project.ext.baseVersion + } + + return project.ext.baseVersion + '-SNAPSHOT' +} + +version = getVersion() +archivesBaseName = 'builder-model' + +//task publishLocal(type: Upload) { +// configuration = configurations.archives +// repositories { +// mavenDeployer { +// repository(url: uri("$rootDir/repo")) +// } +// } +//} + +// custom tasks for creating source/javadoc jars +task sourcesJar(type: Jar, dependsOn:classes) { + classifier = 'sources' + from sourceSets.main.allSource +} + +javadoc { + exclude "**/internal/**" + options.memberLevel = org.gradle.external.javadoc.JavadocMemberLevel.PROTECTED + + title "Android Model" +} + +task javadocJar(type: Jar, dependsOn:javadoc) { + classifier 'javadoc' + from javadoc.destinationDir +} + +// add javadoc/source jar tasks as artifacts +artifacts { + archives jar + archives sourcesJar + archives javadocJar +} diff --git a/builder-model/src/main/java/com/android/builder/model/BuildConfig.java b/builder-model/src/main/java/com/android/builder/model/BuildConfig.java new file mode 100644 index 0000000..f0c4844 --- /dev/null +++ b/builder-model/src/main/java/com/android/builder/model/BuildConfig.java @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2012 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.builder.model; + +import com.android.annotations.NonNull; + +import java.util.List; + +/** + * An object that contain a BuildConfig configuration + */ +public interface BuildConfig { + + /** + * List of Build Config lines. + * @return a non-null list of lines (possibly empty) + */ + @NonNull + List<String> getBuildConfig(); +} diff --git a/builder-model/src/main/java/com/android/builder/model/BuildType.java b/builder-model/src/main/java/com/android/builder/model/BuildType.java new file mode 100644 index 0000000..99202fe --- /dev/null +++ b/builder-model/src/main/java/com/android/builder/model/BuildType.java @@ -0,0 +1,48 @@ +/* + * Copyright (C) 2012 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.builder.model; + +import com.android.annotations.NonNull; +import com.android.annotations.Nullable; + +/** + * a Build Type. + * + * TODO add signing config + */ +public interface BuildType extends BuildConfig { + @NonNull + String getName(); + + boolean isDebuggable(); + + boolean isJniDebugBuild(); + + boolean isRenderscriptDebugBuild(); + + int getRenderscriptOptimLevel(); + + @Nullable + String getPackageNameSuffix(); + + @Nullable + String getVersionNameSuffix(); + + boolean isRunProguard(); + + boolean isZipAlign(); +} diff --git a/builder-model/src/main/java/com/android/builder/model/ProductFlavor.java b/builder-model/src/main/java/com/android/builder/model/ProductFlavor.java new file mode 100644 index 0000000..a80bc39 --- /dev/null +++ b/builder-model/src/main/java/com/android/builder/model/ProductFlavor.java @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2013 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.builder.model; + +import com.android.annotations.NonNull; +import com.android.annotations.Nullable; + +/** + * a Product Flavor + * + * TODO add signing config + */ +public interface ProductFlavor extends BuildConfig { + @NonNull + String getName(); + + @Nullable + String getPackageName(); + + int getVersionCode(); + + @Nullable + String getVersionName(); + + int getMinSdkVersion(); + + int getTargetSdkVersion(); + + int getRenderscriptTargetApi(); + + @Nullable + String getTestPackageName(); + + @Nullable + String getTestInstrumentationRunner(); +} diff --git a/builder-model/src/main/java/com/android/builder/model/SourceProvider.java b/builder-model/src/main/java/com/android/builder/model/SourceProvider.java new file mode 100644 index 0000000..0ae4d77 --- /dev/null +++ b/builder-model/src/main/java/com/android/builder/model/SourceProvider.java @@ -0,0 +1,53 @@ +/* + * Copyright (C) 2012 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.builder.model; + +import com.android.annotations.NonNull; + +import java.io.File; +import java.util.Set; + +/** + * Represent a SourceProvider for a given configuration. + * + * TODO: source filters? + */ +public interface SourceProvider { + + @NonNull + File getManifestFile(); + + @NonNull + Set<File> getJavaDirectories(); + + @NonNull + Set<File> getResourcesDirectories(); + + @NonNull + Set<File> getAidlDirectories(); + + @NonNull + Set<File> getRenderscriptDirectories(); + + @NonNull + Set<File> getJniDirectories(); + + @NonNull + Set<File> getResDirectories(); + + @NonNull + Set<File> getAssetsDirectories(); +} |