diff --git a/oss-licenses-plugin/build.gradle b/oss-licenses-plugin/build.gradle index 319a5103..49de81b0 100644 --- a/oss-licenses-plugin/build.gradle +++ b/oss-licenses-plugin/build.gradle @@ -1,5 +1,6 @@ apply plugin: 'groovy' apply plugin: 'java' +apply plugin: 'java-gradle-plugin' dependencies { implementation gradleApi() @@ -43,3 +44,7 @@ task packageFiles(type: Zip, dependsOn: 'uploadArchives') { def groupDir = rootProject.group.replaceAll('\\.', '/') from("../repo/$groupDir/$rootProject.name/$rootProject.version/") } + +validateTaskProperties { + failOnWarning = true +} diff --git a/oss-licenses-plugin/gradle/wrapper/gradle-wrapper.jar b/oss-licenses-plugin/gradle/wrapper/gradle-wrapper.jar index f6b961fd..5c2d1cf0 100644 Binary files a/oss-licenses-plugin/gradle/wrapper/gradle-wrapper.jar and b/oss-licenses-plugin/gradle/wrapper/gradle-wrapper.jar differ diff --git a/oss-licenses-plugin/gradle/wrapper/gradle-wrapper.properties b/oss-licenses-plugin/gradle/wrapper/gradle-wrapper.properties index 7c4388a9..5028f28f 100644 --- a/oss-licenses-plugin/gradle/wrapper/gradle-wrapper.properties +++ b/oss-licenses-plugin/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/oss-licenses-plugin/gradlew b/oss-licenses-plugin/gradlew index cccdd3d5..83f2acfd 100755 --- a/oss-licenses-plugin/gradlew +++ b/oss-licenses-plugin/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -109,8 +125,8 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` JAVACMD=`cygpath --unix "$JAVACMD"` diff --git a/oss-licenses-plugin/gradlew.bat b/oss-licenses-plugin/gradlew.bat index e95643d6..24467a14 100644 --- a/oss-licenses-plugin/gradlew.bat +++ b/oss-licenses-plugin/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -14,7 +30,7 @@ set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome diff --git a/oss-licenses-plugin/src/main/groovy/com/google/android/gms/oss/licenses/plugin/DependencyTask.groovy b/oss-licenses-plugin/src/main/groovy/com/google/android/gms/oss/licenses/plugin/DependencyTask.groovy index 8d1058f6..09e58b20 100644 --- a/oss-licenses-plugin/src/main/groovy/com/google/android/gms/oss/licenses/plugin/DependencyTask.groovy +++ b/oss-licenses-plugin/src/main/groovy/com/google/android/gms/oss/licenses/plugin/DependencyTask.groovy @@ -25,7 +25,6 @@ import org.gradle.api.artifacts.ConfigurationContainer import org.gradle.api.artifacts.ResolveException import org.gradle.api.artifacts.ResolvedArtifact import org.gradle.api.tasks.Input -import org.gradle.api.tasks.OutputDirectory import org.gradle.api.tasks.OutputFile import org.gradle.api.tasks.TaskAction @@ -51,17 +50,13 @@ class DependencyTask extends DefaultTask { "api"] @Input - public ConfigurationContainer configurations - - @OutputDirectory - public File outputDir + final ConfigurationContainer configurations = project.configurations {} @OutputFile - public File outputFile + File outputFile @TaskAction void action() { - initOutput() updateDependencyArtifacts() if (outputFile.exists() && checkArtifactSet(outputFile)) { @@ -186,10 +181,4 @@ class DependencyTask extends DefaultTask { return null } } - - private void initOutput() { - if (!outputDir.exists()) { - outputDir.mkdirs() - } - } } diff --git a/oss-licenses-plugin/src/main/groovy/com/google/android/gms/oss/licenses/plugin/LicensesCleanUpTask.groovy b/oss-licenses-plugin/src/main/groovy/com/google/android/gms/oss/licenses/plugin/LicensesCleanUpTask.groovy deleted file mode 100644 index d18934e3..00000000 --- a/oss-licenses-plugin/src/main/groovy/com/google/android/gms/oss/licenses/plugin/LicensesCleanUpTask.groovy +++ /dev/null @@ -1,65 +0,0 @@ -/** - * Copyright 2018 Google LLC - * - * 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 - * - * https://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.google.android.gms.oss.licenses.plugin - -import org.gradle.api.DefaultTask -import org.gradle.api.tasks.Input -import org.gradle.api.tasks.TaskAction - -/** - * Task to clean up the generated dependency.json, third_party_licenses and - * third_party_license_metadata files. - */ -class LicensesCleanUpTask extends DefaultTask { - @Input - public File dependencyFile - - @Input - public File dependencyDir - - @Input - public File licensesFile - - @Input - public File metadataFile - - @Input - public File licensesDir - - @TaskAction - void action() { - if (dependencyFile.exists()) { - dependencyFile.delete() - } - - if (dependencyDir.isDirectory() && dependencyDir.list().length == 0) { - dependencyDir.delete() - } - - if (licensesFile.exists()) { - licensesFile.delete() - } - - if (metadataFile.exists()) { - metadataFile.delete() - } - - if (licensesDir.isDirectory() && licensesDir.list().length == 0) { - licensesDir.delete() - } - } -} diff --git a/oss-licenses-plugin/src/main/groovy/com/google/android/gms/oss/licenses/plugin/LicensesTask.groovy b/oss-licenses-plugin/src/main/groovy/com/google/android/gms/oss/licenses/plugin/LicensesTask.groovy index 4144f7d2..c9059948 100644 --- a/oss-licenses-plugin/src/main/groovy/com/google/android/gms/oss/licenses/plugin/LicensesTask.groovy +++ b/oss-licenses-plugin/src/main/groovy/com/google/android/gms/oss/licenses/plugin/LicensesTask.groovy @@ -21,9 +21,11 @@ import org.gradle.api.DefaultTask import org.gradle.api.artifacts.component.ModuleComponentIdentifier import org.gradle.api.artifacts.result.ResolvedArtifactResult import org.gradle.api.internal.artifacts.DefaultModuleIdentifier +import org.gradle.api.tasks.CacheableTask import org.gradle.api.tasks.InputFile -import org.gradle.api.tasks.OutputDirectory import org.gradle.api.tasks.OutputFile +import org.gradle.api.tasks.PathSensitive +import org.gradle.api.tasks.PathSensitivity import org.gradle.api.tasks.TaskAction import org.gradle.internal.component.external.model.DefaultModuleComponentIdentifier import org.gradle.maven.MavenModule @@ -38,6 +40,7 @@ import java.util.zip.ZipFile * file generated by DependencyTask, and then generate the third_party_licenses * and third_party_license_metadata file. */ +@CacheableTask class LicensesTask extends DefaultTask { private static final String UTF_8 = "UTF-8" private static final byte[] LINE_SEPARATOR = System @@ -57,20 +60,17 @@ class LicensesTask extends DefaultTask { protected Map licensesMap = [:] @InputFile - public File dependenciesJson - - @OutputDirectory - public File outputDir + @PathSensitive(PathSensitivity.NONE) + File dependenciesJson @OutputFile - public File licenses + File licenses @OutputFile - public File licensesMetadata + File licensesMetadata @TaskAction void action() { - initOutputDir() initLicenseFile() initLicensesMetadata() @@ -105,12 +105,6 @@ class LicensesTask extends DefaultTask { writeMetadata() } - protected void initOutputDir() { - if (!outputDir.exists()) { - outputDir.mkdirs() - } - } - protected void initLicenseFile() { if (licenses == null) { logger.error("License file is undefined") diff --git a/oss-licenses-plugin/src/main/groovy/com/google/android/gms/oss/licenses/plugin/OssLicensesPlugin.groovy b/oss-licenses-plugin/src/main/groovy/com/google/android/gms/oss/licenses/plugin/OssLicensesPlugin.groovy index 20926c50..0fae285e 100644 --- a/oss-licenses-plugin/src/main/groovy/com/google/android/gms/oss/licenses/plugin/OssLicensesPlugin.groovy +++ b/oss-licenses-plugin/src/main/groovy/com/google/android/gms/oss/licenses/plugin/OssLicensesPlugin.groovy @@ -27,8 +27,6 @@ class OssLicensesPlugin implements Plugin { def dependencyOutput = new File(project.buildDir, "generated/third_party_licenses") def generatedJson = new File(dependencyOutput, "dependencies.json") - getDependencies.configurations = project.getConfigurations() - getDependencies.outputDir = dependencyOutput getDependencies.outputFile = generatedJson def resourceOutput = new File(dependencyOutput, "/res") @@ -39,14 +37,9 @@ class OssLicensesPlugin implements Plugin { def licenseTask = project.tasks.create("generateLicenses", LicensesTask) licenseTask.dependenciesJson = generatedJson - licenseTask.outputDir = outputDir licenseTask.licenses = licensesFile licenseTask.licensesMetadata = licensesMetadataFile - licenseTask.inputs.file(generatedJson) - licenseTask.outputs.dir(outputDir) - licenseTask.outputs.files(licensesFile, licensesMetadataFile) - licenseTask.dependsOn(getDependencies) project.android.applicationVariants.all { BaseVariant variant -> @@ -76,15 +69,5 @@ class OssLicensesPlugin implements Plugin { variant.registerResGeneratingTask(licenseTask, resourceOutput) } } - - def cleanupTask = project.tasks.create("licensesCleanUp", - LicensesCleanUpTask) - cleanupTask.dependencyFile = generatedJson - cleanupTask.dependencyDir = dependencyOutput - cleanupTask.licensesFile = licensesFile - cleanupTask.metadataFile = licensesMetadataFile - cleanupTask.licensesDir = outputDir - - project.tasks.findByName("clean").dependsOn(cleanupTask) } } diff --git a/oss-licenses-plugin/src/test/java/com/google/android/gms/oss/licenses/plugin/LicensesCleanUpTaskTest.java b/oss-licenses-plugin/src/test/java/com/google/android/gms/oss/licenses/plugin/LicensesCleanUpTaskTest.java deleted file mode 100644 index 1d112908..00000000 --- a/oss-licenses-plugin/src/test/java/com/google/android/gms/oss/licenses/plugin/LicensesCleanUpTaskTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/** - * Copyright 2018 Google LLC - * - * 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 - * - * https://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.google.android.gms.oss.licenses.plugin; - -import static org.junit.Assert.assertFalse; - -import java.io.File; -import java.io.IOException; -import org.gradle.api.Project; -import org.gradle.testfixtures.ProjectBuilder; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; - -/** Tests for {@link LicensesCleanUpTask} */ -@RunWith(JUnit4.class) -public class LicensesCleanUpTaskTest { - @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder(); - - @Test - public void testAction() throws IOException { - File testDir = temporaryFolder.newFolder(); - - File dependencyDir = new File(testDir, "dependency"); - dependencyDir.mkdir(); - - File dependencyFile = new File(dependencyDir, "dependency.json"); - - File licensesDir = new File(testDir, "raw"); - licensesDir.mkdir(); - - File licensesFile = new File(licensesDir, "third_party_licenses"); - File metadataFile = new File(licensesDir, "third_party_license_metadata"); - - Project project = ProjectBuilder.builder().withProjectDir(testDir).build(); - LicensesCleanUpTask task = - project.getTasks().create("licensesCleanUp", LicensesCleanUpTask.class); - task.dependencyDir = dependencyDir; - task.dependencyFile = dependencyFile; - task.licensesDir = licensesDir; - task.licensesFile = licensesFile; - task.metadataFile = metadataFile; - - task.action(); - assertFalse(task.dependencyFile.exists()); - assertFalse(task.dependencyDir.exists()); - assertFalse(task.licensesFile.exists()); - assertFalse(task.metadataFile.exists()); - assertFalse(task.licensesDir.exists()); - } -} diff --git a/oss-licenses-plugin/src/test/java/com/google/android/gms/oss/licenses/plugin/LicensesTaskTest.java b/oss-licenses-plugin/src/test/java/com/google/android/gms/oss/licenses/plugin/LicensesTaskTest.java index 1f5eb6de..8c2a86d5 100644 --- a/oss-licenses-plugin/src/test/java/com/google/android/gms/oss/licenses/plugin/LicensesTaskTest.java +++ b/oss-licenses-plugin/src/test/java/com/google/android/gms/oss/licenses/plugin/LicensesTaskTest.java @@ -16,16 +16,14 @@ package com.google.android.gms.oss.licenses.plugin; -import static org.gradle.internal.impldep.org.testng.Assert.fail; -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.core.Is.is; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.anyInt; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; +import org.gradle.api.Project; +import org.gradle.testfixtures.ProjectBuilder; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.rules.TemporaryFolder; +import org.junit.runner.RunWith; +import org.junit.runners.JUnit4; import java.io.ByteArrayInputStream; import java.io.File; @@ -36,14 +34,17 @@ import java.nio.file.Files; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; -import org.gradle.api.Project; -import org.gradle.testfixtures.ProjectBuilder; -import org.junit.Before; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.TemporaryFolder; -import org.junit.runner.RunWith; -import org.junit.runners.JUnit4; + +import static org.gradle.internal.impldep.org.testng.Assert.fail; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.core.Is.is; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.ArgumentMatchers.any; +import static org.mockito.ArgumentMatchers.anyInt; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; /** Tests for {@link LicensesTask} */ @RunWith(JUnit4.class) @@ -53,21 +54,21 @@ public class LicensesTaskTest { private static final String LINE_BREAK = System.getProperty("line.separator"); private Project project; private LicensesTask licensesTask; + private File outputDir; @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder(); @Before public void setUp() throws IOException { - File outputDir = temporaryFolder.newFolder(); + outputDir = temporaryFolder.newFolder(); File outputLicenses = new File(outputDir, "testLicenses"); File outputMetadata = new File(outputDir, "testMetadata"); project = ProjectBuilder.builder().withProjectDir(new File(BASE_DIR)).build(); licensesTask = project.getTasks().create("generateLicenses", LicensesTask.class); - licensesTask.outputDir = outputDir; - licensesTask.licenses = outputLicenses; - licensesTask.licensesMetadata = outputMetadata; + licensesTask.setLicenses(outputLicenses); + licensesTask.setLicensesMetadata(outputMetadata); } private void createLicenseZip(String name) throws IOException { @@ -84,27 +85,20 @@ private void createLicenseZip(String name) throws IOException { output.close(); } - @Test - public void testInitOutputDir() { - licensesTask.initOutputDir(); - - assertTrue(licensesTask.outputDir.exists()); - } - @Test public void testInitLicenseFile() throws IOException { licensesTask.initLicenseFile(); - assertTrue(licensesTask.licenses.exists()); - assertEquals(0, Files.size(licensesTask.licenses.toPath())); + assertTrue(licensesTask.getLicenses().exists()); + assertEquals(0, Files.size(licensesTask.getLicenses().toPath())); } @Test public void testInitLicensesMetadata() throws IOException { licensesTask.initLicensesMetadata(); - assertTrue(licensesTask.licensesMetadata.exists()); - assertEquals(0, Files.size(licensesTask.licensesMetadata.toPath())); + assertTrue(licensesTask.getLicensesMetadata().exists()); + assertEquals(0, Files.size(licensesTask.getLicensesMetadata().toPath())); } @Test @@ -126,7 +120,7 @@ public void testAddLicensesFromPom() throws IOException { String group1 = "groupA"; licensesTask.addLicensesFromPom(deps1, group1, name1); - String content = new String(Files.readAllBytes(licensesTask.licenses.toPath()), UTF_8); + String content = new String(Files.readAllBytes(licensesTask.getLicenses().toPath()), UTF_8); String expected = "http://www.opensource.org/licenses/mit-license.php" + LINE_BREAK; assertTrue(licensesTask.licensesMap.containsKey("groupA:deps1")); assertEquals(expected, content); @@ -144,7 +138,7 @@ public void testAddLicensesFromPom_withoutDuplicate() throws IOException { String group2 = "groupB"; licensesTask.addLicensesFromPom(deps2, group2, name2); - String content = new String(Files.readAllBytes(licensesTask.licenses.toPath()), UTF_8); + String content = new String(Files.readAllBytes(licensesTask.getLicenses().toPath()), UTF_8); String expected = "http://www.opensource.org/licenses/mit-license.php" + LINE_BREAK @@ -169,7 +163,7 @@ public void testAddLicensesFromPom_withMultiple() throws IOException { String group2 = "groupE"; licensesTask.addLicensesFromPom(deps2, group2, name2); - String content = new String(Files.readAllBytes(licensesTask.licenses.toPath()), UTF_8); + String content = new String(Files.readAllBytes(licensesTask.getLicenses().toPath()), UTF_8); String expected = "http://www.opensource.org/licenses/mit-license.php" + LINE_BREAK @@ -197,7 +191,7 @@ public void testAddLicensesFromPom_withDuplicate() throws IOException { String group2 = "groupA"; licensesTask.addLicensesFromPom(deps2, group2, name2); - String content = new String(Files.readAllBytes(licensesTask.licenses.toPath()), UTF_8); + String content = new String(Files.readAllBytes(licensesTask.getLicenses().toPath()), UTF_8); String expected = "http://www.opensource.org/licenses/mit-license.php" + LINE_BREAK; assertThat(licensesTask.licensesMap.size(), is(1)); @@ -239,13 +233,13 @@ public void testGetBytesFromInputStream_specialCharacters() { @Test public void testAddGooglePlayServiceLicenses() throws IOException { - File tempOutput = new File(licensesTask.outputDir, "dependencies/groupC"); + File tempOutput = new File(outputDir, "dependencies/groupC"); tempOutput.mkdirs(); createLicenseZip(tempOutput.getPath() + "play-services-foo-license.aar"); File artifact = new File(tempOutput.getPath() + "play-services-foo-license.aar"); licensesTask.addGooglePlayServiceLicenses(artifact); - String content = new String(Files.readAllBytes(licensesTask.licenses.toPath()), UTF_8); + String content = new String(Files.readAllBytes(licensesTask.getLicenses().toPath()), UTF_8); String expected = "safeparcel" + LINE_BREAK + "JSR 305" + LINE_BREAK; assertEquals(expected, content); assertThat(licensesTask.googleServiceLicenses.size(), is(2)); @@ -258,12 +252,12 @@ public void testAddGooglePlayServiceLicenses() throws IOException { @Test public void testAddGooglePlayServiceLicenses_withoutDuplicate() throws IOException { - File groupC = new File(licensesTask.outputDir, "dependencies/groupC"); + File groupC = new File(outputDir, "dependencies/groupC"); groupC.mkdirs(); createLicenseZip(groupC.getPath() + "/play-services-foo-license.aar"); File artifactFoo = new File(groupC.getPath() + "/play-services-foo-license.aar"); - File groupD = new File(licensesTask.outputDir, "dependencies/groupD"); + File groupD = new File(outputDir, "dependencies/groupD"); groupD.mkdirs(); createLicenseZip(groupD.getPath() + "/play-services-bar-license.aar"); File artifactBar = new File(groupD.getPath() + "/play-services-bar-license.aar"); @@ -271,7 +265,7 @@ public void testAddGooglePlayServiceLicenses_withoutDuplicate() throws IOExcepti licensesTask.addGooglePlayServiceLicenses(artifactFoo); licensesTask.addGooglePlayServiceLicenses(artifactBar); - String content = new String(Files.readAllBytes(licensesTask.licenses.toPath()), UTF_8); + String content = new String(Files.readAllBytes(licensesTask.getLicenses().toPath()), UTF_8); String expected = "safeparcel" + LINE_BREAK + "JSR 305" + LINE_BREAK; assertEquals(expected, content); assertThat(licensesTask.googleServiceLicenses.size(), is(2)); @@ -287,7 +281,7 @@ public void testAppendLicense() throws IOException { licensesTask.appendLicense("license1", "test".getBytes(UTF_8)); String expected = "test" + LINE_BREAK; - String content = new String(Files.readAllBytes(licensesTask.licenses.toPath()), UTF_8); + String content = new String(Files.readAllBytes(licensesTask.getLicenses().toPath()), UTF_8); assertTrue(licensesTask.licensesMap.containsKey("license1")); assertEquals(expected, content); } @@ -299,7 +293,7 @@ public void testWriteMetadata() throws IOException { licensesTask.writeMetadata(); String expected = "0:4 license1" + LINE_BREAK + "6:10 license2" + LINE_BREAK; - String content = new String(Files.readAllBytes(licensesTask.licensesMetadata.toPath()), UTF_8); + String content = new String(Files.readAllBytes(licensesTask.getLicensesMetadata().toPath()), UTF_8); assertEquals(expected, content); } }