Brian O'Connor | e8468b5 | 2016-07-25 13:42:36 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2016-present Open Networking Laboratory |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.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.apache.org/licenses/LICENSE-2.0 |
| 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 | package org.onosproject.onosjar; |
| 17 | |
| 18 | import com.facebook.buck.jvm.java.CompileToJarStepFactory; |
| 19 | import com.facebook.buck.jvm.java.DefaultJavaLibrary; |
| 20 | import com.facebook.buck.model.BuildTarget; |
| 21 | import com.facebook.buck.rules.AddToRuleKey; |
| 22 | import com.facebook.buck.rules.BuildRule; |
| 23 | import com.facebook.buck.rules.BuildRuleParams; |
| 24 | import com.facebook.buck.rules.SourcePath; |
| 25 | import com.facebook.buck.rules.SourcePathResolver; |
| 26 | import com.google.common.base.Optional; |
| 27 | import com.google.common.collect.ImmutableList; |
| 28 | import com.google.common.collect.ImmutableSet; |
| 29 | import com.google.common.collect.ImmutableSortedSet; |
| 30 | |
| 31 | import java.nio.file.Path; |
| 32 | import java.util.Set; |
| 33 | import java.util.regex.Pattern; |
| 34 | |
| 35 | /** |
| 36 | * Implementation of a build rule that generates a onosjar.json file for a set |
| 37 | * of Java sources. |
| 38 | */ |
| 39 | public class OnosJar extends DefaultJavaLibrary { |
| 40 | |
| 41 | @AddToRuleKey |
| 42 | final Optional<String> webContext; |
| 43 | |
| 44 | @AddToRuleKey |
| 45 | final Optional<String> apiTitle; |
| 46 | |
| 47 | @AddToRuleKey |
| 48 | final Optional<String> apiVersion; |
| 49 | |
| 50 | @AddToRuleKey |
| 51 | final Optional<String> apiPackage; |
| 52 | |
| 53 | @AddToRuleKey |
| 54 | final Optional<String> apiDescription; |
| 55 | |
| 56 | public OnosJar(BuildRuleParams params, |
| 57 | SourcePathResolver resolver, |
| 58 | Set<? extends SourcePath> srcs, |
| 59 | Set<? extends SourcePath> resources, |
| 60 | Optional<Path> generatedSourceFolder, |
| 61 | Optional<SourcePath> proguardConfig, |
| 62 | ImmutableList<String> postprocessClassesCommands, |
| 63 | ImmutableSortedSet<BuildRule> exportedDeps, |
| 64 | ImmutableSortedSet<BuildRule> providedDeps, |
| 65 | SourcePath abiJar, boolean trackClassUsage, |
| 66 | ImmutableSet<Path> additionalClasspathEntries, |
| 67 | CompileToJarStepFactory compileStepFactory, |
| 68 | Optional<Path> resourcesRoot, |
| 69 | Optional<String> mavenCoords, |
| 70 | ImmutableSortedSet<BuildTarget> tests, |
| 71 | ImmutableSet<Pattern> classesToRemoveFromJar, |
| 72 | Optional<String> webContext, |
| 73 | Optional<String> apiTitle, |
| 74 | Optional<String> apiVersion, |
| 75 | Optional<String> apiPackage, |
| 76 | Optional<String> apiDescription) { |
| 77 | super(params, resolver, srcs, resources, generatedSourceFolder, |
| 78 | proguardConfig, postprocessClassesCommands, exportedDeps, |
| 79 | providedDeps, abiJar, trackClassUsage, additionalClasspathEntries, |
| 80 | compileStepFactory, resourcesRoot, mavenCoords, tests, |
| 81 | classesToRemoveFromJar); |
| 82 | this.webContext = webContext; |
| 83 | this.apiTitle = apiTitle; |
| 84 | this.apiVersion = apiVersion; |
| 85 | this.apiPackage = apiPackage; |
| 86 | this.apiDescription = apiDescription; |
| 87 | } |
| 88 | } |